Hi there!
I’ve been having a problem with nvcc.
#1 nvcc is correctly installed, I can run nvcc -cuda foo.cu on some simple valid source, and it compiles the device code into foo.cu.cpp
#2 When I try to compile my project to C source (from a .cu file), NVCC spits a hundred errors at me of the form:
[font=“Courier New”]
/usr/local/cuda/bin/…/include/device_types.h(46): error: invalid redeclaration of type name “cudaRoundMode”
(46): here
/usr/local/cuda/bin/…/include/device_types.h(48): error: “cudaRoundNearest” has already been declared in the current scope
/usr/local/cuda/bin/…/include/device_types.h(49): error: “cudaRoundZero” has already been declared in the current scope
…
/usr/local/cuda/bin/…/include/vector_types.h(262): error: invalid redeclaration of type name “float1”
(368): here
/usr/local/cuda/bin/…/include/vector_types.h(268): error: invalid redeclaration of type name “float2”
(370): here
/usr/local/cuda/bin/…/include/vector_types.h(274): error: invalid redeclaration of type name “float3”
(372): here
[/font]
It looks like nvcc is including some headers twice, and indeed if I use the -E switch to just do the preprocessing:
nvcc -E foo.cu > temp
grep -n “float3” temp
I get:
3262:typedef struct float3 float3;
120111:typedef struct float3 float3;
I’m pulling my hair out – what in my project could be causing nvcc to include its headers twice??
Many thanks for the help,
Michael