Help with this compilation error

I just took an old project and I'm not sure what the following error might mean.

g++ -o BufferedReader.o -c -g -Wall -std=c++0x -I/usr/include/xmms2 -Ijsoncpp/include/json/ -fopenmp -I/usr/include/ImageMagick -I/usr/include/xmms2 -I/usr/include/libvisual-0.4 -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SCRIPT_LIB -DQT_SHARED -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtScript BufferedReader.cpp
In file included from BufferedReader.cpp:23:
/usr/include/string.h:36:42: error: missing binary operator before token "("
In file included from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/cwchar:47,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/bits/postypes.h:42,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/iosfwd:42,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/ios:39,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/istream:40,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/sstream:39,
                 from BufferedReader.cpp:24:

Line 24 of BufferedReader.cpp indicates #include <string.h>. I have only tried this with <string>, but am getting the same. Any clue?

Here is a code snippet from string.h

/* Tell the caller that we provide correct C++ prototypes.  */
#if defined __cplusplus && __GNUC_PREREQ (4, 4) //line 36
# define __CORRECT_ISO_CPP_STRING_H_PROTO
#endif

Does this mean that __GNUC_PREREQ is undefined?

Edit:

Change -Ijsoncpp/include/json/to Ijsoncpp/includestopped errors. I noticed that I turned on <json/json.h>.

I am going to switch to JsonGlib, although for this reason I pulled out the project again. So all is well. :)

+3
source share
3 answers

, , include , . , (;). , 22 BufferedReader.cpp .

+4

, , : string.h <features.h>, /usr/include/features.h . dir json/ features.h, , include-, , , , , string.h.

+4

Give it a try #include <cstring>.

+3
source

Source: https://habr.com/ru/post/1750048/


All Articles