[英]Simple boost program with nvcc - error: declaration does not declare anything [-fpermissive]
背景
我想使用boost库来序列化cuda中的一些对象。 我有一个更大的 Makefile,nvcc 编译了大约 20 个文件。 我希望用 boost 库编写 Makefile 的最小工作示例,然后将其添加到我更大的 makefile
Makefile
LIBS=--relocatable-device-code=true -lcusolver -lcusparse
ARCH=-arch=sm_30
OPTIONS= -O2
hello: main.o
nvcc $(OPTIONS) $(ARCH) $(LIBS) -L${BOOST_ROOT}/lib/ -llibboost main.o -o hello
main.o: main.cpp
nvcc $(OPTIONS) $(ARCH) $(LIBS) -c main.cpp -o main.o
clean:
rm -rf *.o hello.*
主文件
#include <iostream>
#include <boost/optional.hpp>
using namespace std;
int main() {
boost::optional<string>;
return 0;
}
运行make hello &&./hello
我得到的错误
[ test]$ make hello && ./hello
nvcc -O2 -arch=sm_30 --relocatable-device-code=true -lcusolver -lcusparse -c main.cpp -o main.o
main.cpp: In function ‘int main()’:
main.cpp:8:12: error: declaration does not declare anything [-fpermissive]
boost::optional<string>;
^
make: *** [main.o] Error
你没有给你的变量一个名字。 尝试将其更改为:
boost::optional<string> exampleName;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.