My C++ compiler cannot understand the restrict directive.
How do I suppress these errors?
/usr/include/inttypes.h:271: error: expected ',' or '...' before 'nptr'
usr/include/inttypes.h contains
extern intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base);
Compile command:
g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall
-W -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-DPIC -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -o player.o ../dir/player.cpp
Edit:
$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
G++ doesn’t support the
restrictkeyword, which is valid in C but not C++.It does support
__restrict__as an extension, so you could compile with-Drestrict=__restrict__to use the preprocessor to turn it into the accepted keyword.See http://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html for details.
The issue seems to be caused by your use of
-DISOC99_SOURCEwhich doesn’t seem to be compatible with C++ on your OS, since it enables C99 features that are not valid in C++. On GNU/Linux I would suggest using-D_GNU_SOURCEinstead, but I doubt that works on Mac OS X.So instead of
-Drestrict=__restrict__you could just stop using-D_ISOC99_SOURCE— why do you even need that for C++?