My project builds on Windows (vc 17) and I am new to Linux builds so I am not sure what is going on.
I created CMakeLists files for my project (with a C 17 requirement), generated the makefile, and then I used make
to try build it on Linux. The error is:
/home/julien/source/zipfs/zipfs/include/zipfs/zipfs_assert.h:30:70: error: no matching function for call to ‘std::exception::exception(<brace-enclosed initializer list>)’
30 | zipfs_usage_error_t(const char* message) : std::exception{ message } {}
| ^
In file included from /usr/include/c /9/exception:38,
from /usr/include/c /9/new:40,
from /usr/include/c /9/ext/new_allocator.h:33,
from /usr/include/x86_64-linux-gnu/c /9/bits/c allocator.h:33,
from /usr/include/c /9/bits/allocator.h:46,
from /usr/include/c /9/string:41,
from /home/julien/source/zipfs/zipfs/include/zipfs/zipfs_path_t.h:3,
from /home/julien/source/zipfs/zipfs/include/zipfs/zipfs_error_t.h:3,
from /home/julien/source/zipfs/zipfs/source/zipfs_error_t.cpp:1:
The incriminated code is:
zipfs_usage_error_t(const char* message) : std::exception{ message } {}
I don't see what is wrong with this; is it a c version mismatch ?
CodePudding user response:
std::exception
does not provide a constructor that accepts a const char*
parameter.
If one exists on the Windows standard library you are using, it is a non-portable extension to the language.
There are many derived classes that could be used as your base class instead, which do support this constructor.