I am building a cmake project that includes cuda code. I am unable to compile one of the cuda files that includes several h files. This is the compiler error I receive
In file included from /usr/include/c++/4.4/bits/basic_ios.h:39,
from /usr/include/c++/4.4/ios:45,
from /usr/include/c++/4.4/ostream:40,
from /usr/include/c++/4.4/iostream:40,
from /home/pfeifs/Developement/Deform/LinuxDeform/LibDeform/Deform/cutil_comfunc.h:20,
from /home/pfeifs/Developement/Deform/LinuxDeform/LibDeform/Deform/VectorMathDef.h:22,
from /home/pfeifs/Developement/Deform/LinuxDeform/LibDeform/src/Deform/VectorMath.cu:15:
/usr/include/c++/4.4/bits/locale_facets.h:2521:44: error: macro "isspace" passed 2 arguments, but takes just 1
isspace() is defined as a macro requiring one argument in <ctype.h> and declared as a templated function in locale_facets.h. (These are both standard files.) However at the beginning of locale_facets.h, <cctype> is included and that undeclares the macro.
Any help or insight into this problem is greatly appreciated.
Do not mix and match C and C++ headers.
Use
#include <locale>to pull in thestd::isspacetemplate with two parameters. Use#include <cctype>for a C++ safe include ofctype.hthat won’t cause conflicts with STL.If you are writing a C program and don’t want or need C++ then there should be no problem including
ctype.hand using theisspacefunction with only one parameter.