errors on "nvcc my.cu -ptx" nvcc compile

Hi, I’m using the Jan15 version of cuda sdk0.8.
I read nvcc.pdf, use cmd line “nvcc mykernel.cu -ptx” to get .ptx to see what’s going on with my kernle.
I got error:
could not open source file “cutil.h”
#include “cutil.h”
^
but “cutil.h” should be found, actually I can run mykernel.cu. anyway, i copied a cutil.h into the same folder with mykernel.cu.

then tried again, getting below errors i don’t know:

tmp_00000110-8.i
D:\CUDA\bin…/include\device_functions.h(205) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\device_functions.h(205) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\device_functions.h(205) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\device_functions.h(212) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\device_functions.h(212) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\device_functions.h(212) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(870) : error C2632: ‘long’ followed by ’
long’ is illegal
D:\CUDA\bin…/include\math_functions.h(875) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(875) : error C2146: syntax error : missi
ng ‘;’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(875) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(875) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(875) : error C2143: syntax error : missi
ng ‘;’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(875) : error C2065: ‘l’ : undeclared ide
ntifier
D:\CUDA\bin…/include\math_functions.h(2280) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(2285) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2285) : error C2146: syntax error : miss
ing ‘;’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2285) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2285) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2285) : error C2143: syntax error : miss
ing ‘;’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2292) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(2297) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2297) : error C2146: syntax error : miss
ing ‘;’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2297) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2297) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2297) : error C2143: syntax error : miss
ing ‘;’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2304) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(2309) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2309) : error C2146: syntax error : miss
ing ‘;’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2309) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2309) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2309) : error C2143: syntax error : miss
ing ‘;’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2468) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(2470) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(2476) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2476) : error C2146: syntax error : miss
ing ‘;’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2476) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2476) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2476) : error C2143: syntax error : miss
ing ‘;’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2478) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2478) : error C2146: syntax error : miss
ing ‘)’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2478) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2478) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2478) : error C2143: syntax error : miss
ing ‘)’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2478) : error C2059: syntax error : ‘)’
D:\CUDA\bin…/include\math_functions.h(2478) : error C2143: syntax error : miss
ing ‘;’ before ‘{’
D:\CUDA\bin…/include\math_functions.h(2481) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2481) : error C2146: syntax error : miss
ing ‘)’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2481) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2481) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2481) : error C2143: syntax error : miss
ing ‘)’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2481) : error C2059: syntax error : ‘)’
D:\CUDA\bin…/include\math_functions.h(2481) : error C2143: syntax error : miss
ing ‘;’ before ‘{’
D:\CUDA\bin…/include\math_functions.h(2492) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(2494) : error C2632: ‘long’ followed by
‘long’ is illegal
D:\CUDA\bin…/include\math_functions.h(2500) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2500) : error C2146: syntax error : miss
ing ‘;’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2500) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2500) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2500) : error C2143: syntax error : miss
ing ‘;’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2502) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2502) : error C2146: syntax error : miss
ing ‘)’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2502) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2502) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2502) : error C2143: syntax error : miss
ing ‘)’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2502) : error C2059: syntax error : ‘)’
D:\CUDA\bin…/include\math_functions.h(2502) : error C2143: syntax error : miss
ing ‘;’ before ‘{’
D:\CUDA\bin…/include\math_functions.h(2505) : error C2059: syntax error : ‘bad
suffix on number’
D:\CUDA\bin…/include\math_functions.h(2505) : error C2146: syntax error : miss
ing ‘)’ before identifier ‘l’
D:\CUDA\bin…/include\math_functions.h(2505) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2505) : error C2144: syntax error : ‘’ should be preceded by ‘’
D:\CUDA\bin…/include\math_functions.h(2505) : error C2143: syntax error : miss
ing ‘)’ before ‘identifier’
D:\CUDA\bin…/include\math_functions.h(2505) : error C2059: syntax error : ‘)’
D:\CUDA\bin…/include\math_functions.h(2505) : error C2143: syntax error : miss
ing ‘;’ before ‘{’

how to deal with it?
Thanks very much!

I’m assuming that means when you compile it Visual Studio it works. And then it doesn’t work when you just type nvcc -ptx mykernel.cu at the command line.

Perhaps looking at how nvcc is invoked in Visual Studio would be useful…

The command I would issue under linux, would look something like this:

nvcc -ptx cuda_integration.cu -I. -I/usr/local/cuda/include -I…/…/common/inc -DUNIX

You need to tell nvcc where to look for all the include files… there may be some sort of flag similar to -DUNIX as well, I’m not sure.

duplicate message…

Another one…

Thank you very much!

Yes I can pass compile and run with msvc.

yes I also want do -I … but I don’t know what are needed.