Reputation: 133
I'm trying to integrate CUDA to an existing aplication wich uses boost::spirit.
Isolating the problem, I've found out that the following code does not copile with nvcc:
main.cu
:
#include <boost/spirit/include/qi.hpp>
int main(){
exit(0);
}
Compiling with nvcc -o cudaTest main.cu
I get a lot of errors that can be seen here.
But if I change the filename to main.cpp
, and compile again using nvcc
, it works. What is happening here and how can I fix it?
Upvotes: 4
Views: 2426
Reputation: 11416
nvcc
sometimes has trouble compiling complex template code such as is found in Boost, even if the code is only used in __host__
functions.
When a file's extension is .cpp
, nvcc
performs no parsing itself and instead forwards the code to the host compiler, which is why you observe different behavior depending on the file extension.
If possible, try to quarantine code which depends on Boost into .cpp
files which needn't be parsed by nvcc
.
I'd also make sure to try the nvcc
which ships with the recent CUDA 4.1. nvcc
's template support improves with each release.
Upvotes: 5