Question about include files

Hey guys,

I am pretty new to CUDA, and am experiencing some problems in compiling the sample projects using nvcc. Each time I try, it errors out, saying that some header files cannot be found.

For example

C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\projects\gbv - vector test>


"C:\CUDA\bin/../include/driver_types.h", line 47: error: could not open source

          file "limits.h"

  #include <limits.h>


"C:\CUDA\bin/../include/driver_types.h", line 48: error: could not open source

          file "stddef.h"

  #include <stddef.h>


"C:\CUDA\bin/../include/common_functions.h", line 49: error: could not open

          source file "time.h"

  #include <time.h>


"C:\CUDA\bin/../include/math_functions.h", line 321: error: could not open

          source file "math.h"

  #include <math.h>


"C:\CUDA\bin/../include/math_functions.h", line 322: error: could not open

          source file "stdlib.h"

  #include <stdlib.h>


"", line 2: error: could not open source file "stdio.h"

  #include "stdio.h"


"", line 61: warning: last line of file ends without a newline



6 errors detected in the compilation of "".

Could Not Find c:\windows\temp\tmp_00000ed4*

I did not think we had to get these header files separately. Are we supposed to? Any help would be appreciated.


same problem here… :(

If the code fragment above is from the DOS shell and “vcc” actually is “nvcc” then you forgot to give it the VisualStudio include paths. See the custom build settings in the VS projects how the command line should look like.


Have you add those folder locations into INCLUDES and LIBRARIES parameter in nvcc.profile? I encountered the same thing when I tried to include cutil.h, and it was worked.

Well you might not want to use cutil in all your projects. The files not found in the above output are stdlib files and not CUDA files. They are therefore environment dependent. You can edit nvcc.profile but this is a bad hack as you basically bind nvcc to the specific compiler paths on your machine. So the Makefile/vcproj won’t work for other people or if you switch compilers (VS7, VS8, GCC). So pass the system paths with -I to nvcc and take care that the build system produces appropriate lines according to your compiler environment.


Peter, you’re right. Passing system paths via -I to nvcc is a much cleaner way. Thank you.