I'm working on a project that uses the GNU common C++ class framework (1.8.1-7.el7). The project is written using C++98 (GCC 4.8.5) and I wanted to port it to C++11 or higher. When I compiled it using GCC 9.3.1, I get errors similar to the following:
[me@centos7 ~/github/myproject/utility2]$ make
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -MT utility2.lo -MD -MP -MF .deps/utility2.Tpo -c -o utility2.lo utility2.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -MT utility2.lo -MD -MP -MF .deps/utility2.Tpo -c utility2.cpp -fPIC -DPIC -o .libs/utility2.o
In file included from /usr/include/cc++/thread.h:50,
from ../include/myproject/utility1.h:4,
from ../include/myproject/utility2.h:6,
from utility2.cpp:1:
/usr/include/cc++/string.h:734:35: error: friend declaration of 'std::istream& getline(std::istream&, ost::String&, char, size_t)' specifies default arguments and isn't a definition [-fpermissive]
734 | friend __EXPORT std::istream &getline(std::istream &is, String &str, char delim = '\n', size_t size = 0);
| ^~~~~~~
make: *** [utility2.lo] Error 1
I read from here and here that it is impossible to selectively add -fpermissive to compile specific files (in this case, cc++/string.h from the GNU common C++ class framework) using modern GCC versions. I don't want to apply -fpermissive to all my files as that would not be good programming.
Is there a way to compile the GNU Common C++ class framework using C++11 or higher versions without having to broadly apply -fpermissive to all my files in the project? If so, how?
Aucun commentaire:
Enregistrer un commentaire