Background
I want to use boost library to serialize some objects in cuda. I have a bigger Makefile with nvcc compiling about 20 files. I hope to write the smallest working example of Makefile with boost library and then add it to my larger 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.*
main.cpp
#include <iostream>
#include <boost/optional.hpp>
using namespace std;
int main() {
boost::optional<string>;
return 0;
}
Running
make hello && ./hello
Error which I get
[ 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
You have not given your variable a name. Try changing it to:
boost::optional<string> exampleName;