VASim icon indicating copy to clipboard operation
VASim copied to clipboard

Compiling with GCC > 5

Open Agnishom opened this issue 4 years ago • 1 comments

I am using Ubuntu 20.04 and I do not really want to downgrade my compiler to gcc 5.

So, I went to the Makefile and replaced line 2 with CC = g++ instead of g++-5

But this gives me a lot of errors, starting with:

Compiling MNRL Library...
make ./libs/MNRL/C++/libmnrl.a
make[1]: Entering directory '/home/agnishom/code/hardware-automata/VASim'
make CC=g++ -C ./libs/MNRL/C++
make[2]: Entering directory '/home/agnishom/code/hardware-automata/VASim/libs/MNRL/C++'
/home/agnishom/code/hardware-automata/VASim/libs/MNRL/C++
g++ -I./include -I./lib/valijson/include -I./lib/valijson/thirdparty/nlohmann-json-1.1.0 -I./lib/json11 --std=c++11 -fPIC -c -o src/obj/mnrl.o src/mnrl.cpp
In file included from ./lib/valijson/include/valijson/adapters/json11_adapter.hpp:34,
                 from src/mnrl.cpp:11:
./lib/valijson/include/valijson/adapters/basic_adapter.hpp: In member function ‘virtual bool valijson::adapters::BasicAdapter<AdapterType, ArrayType, ObjectMemberType, ObjectType, ValueType>::applyToArray(valijson::adapters::Adapter::ArrayValueCallback) const’:
./lib/valijson/include/valijson/adapters/basic_adapter.hpp:251:24: error: ‘optional’ in namespace ‘opt’ does not name a template type
  251 |             const opt::optional<Array> array = value.getArrayOptional();
      |                        ^~~~~~~~
./lib/valijson/include/valijson/adapters/basic_adapter.hpp:251:19: note: ‘std::optional’ is only available from C++17 onwards
  251 |             const opt::optional<Array> array = value.getArrayOptional();
      |                   ^~~
./lib/valijson/include/valijson/adapters/basic_adapter.hpp:252:47: error: ‘array’ was not declared in this scope; did you mean ‘std::array’?
  252 |             for (const AdapterType element : *array) {
      |                                               ^~~~~
      |                                               std::array
In file included from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/bits/stl_map.h:63,
                 from /usr/include/c++/9/map:61,
                 from ./lib/json11/json11.hpp:55,
                 from src/mnrl.cpp:9:
/usr/include/c++/9/array:94:12: note: ‘std::array’ declared here
   94 |     struct array
      |            ^~~~~
In file included from ./lib/valijson/include/valijson/adapters/json11_adapter.hpp:34,
                 from src/mnrl.cpp:11:
./lib/valijson/include/valijson/adapters/basic_adapter.hpp: In member function ‘virtual bool valijson::adapters::BasicAdapter<AdapterType, ArrayType, ObjectMemberType, ObjectType, ValueType>::applyToObject(valijson::adapters::Adapter::ObjectMemberCallback) const’:
./lib/valijson/include/valijson/adapters/basic_adapter.hpp:269:24: error: ‘optional’ in namespace ‘opt’ does not name a template type
  269 |             const opt::optional<Object> object = value.getObjectOptional();
      |                        ^~~~~~~~
./lib/valijson/include/valijson/adapters/basic_adapter.hpp:269:19: note: ‘std::optional’ is only available from C++17 onwards
  269 |             const opt::optional<Object> object = value.getObjectOptional();
      |                   ^~~
./lib/valijson/include/valijson/adapters/basic_adapter.hpp:270:51: error: ‘object’ was not declared in this scope; did you mean ‘Object’?
  270 |             for (const ObjectMemberType member : *object) {
      |                                                   ^~~~~~
      |                                                   Object

Later EDIT: it looks like the source was written with g++-5 in mind. Any suggestions on how to install g++-5 on Ubuntu 20.04?

Agnishom avatar Jul 06 '21 16:07 Agnishom

This issue has been resolved with the latest pull request, #43

tjt7a avatar Sep 14 '23 14:09 tjt7a