我正在构建一个包含cuda代码的cmake项目。我无法编译其中一个包含多个h文件的cuda文件。这是我收到的编译器错误
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在<ctype.h>中将isspace()定义为需要一个参数的宏,并在locale_facets.h中将其声明为模板函数。(这些都是标准文件。)然而,在locale_facets.h的开头,包含了<cctype>,这就取消了宏的声明。
对这个问题的任何帮助或见解都是非常感谢的。
发布于 2012-06-16 08:46:10
不要混用C和C++标头。
使用#include <locale>引入带有两个参数的std::isspace模板。对于不会导致与STL冲突的C++安全包含ctype.h,请使用#include <cctype>。
如果您正在编写C程序,并且不想要或不需要C++,那么应该没有问题,包括ctype.h和使用只有一个参数的isspace函数。
https://stackoverflow.com/questions/11059308
复制相似问题