Problems with include paths under VC 2005 nvcc can't find <cutil.h>

I have tried copying the ‘template’ project from its location in the SDK to a new directory. Clearly, this means that I must modify the reference to the include dir “…/…/common/inc” that was used previously.

I have tried doing this in a number of ways, including:

* Adding the new directory to the project include path
* Adding the directory to the CUDA_INC_PATH environment variable
* Both of these simultaneously

Unfortunately, none of these steps make any difference.

The include dir is:

[b]"C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc"[/b]

and I’ve checked that Visual Studio is inserting quotes around the path, as appropriate.

Is there still a problem with spaces in include paths, or have I missed something? :huh:

(BTW: I am running V1.0 of the SDK)

Sigh… 48 views of this post, but NO replies! Either I’m being really stupid - which is entirely possible - or else nobody knows the answer - which I find unlikely.

Can somebody please help me - otherwise, I won’t be able to create any projects outside of the SDK directory structure - which will not be possible going forward, since I need to put my projects under source control.

Any advice will be most gratefully received! :hug:

I had this problem too…can’t remember for the life of me how I fixed it!

Could this be the least helpful post of the year!

Sorry,

Chris

At least I know I’m not alone - although it does feel like it. <img src=‘http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/crying.gif’ class=‘bbc_emoticon’ alt=’:’(’ />

:thumbup: OK, I think I’ve cracked it! Here is the answer for the record:

The series of directories assigned to the CUDA_INC_PATH environment variable must be separated using commas ‘,’ not semi-colons as is normally the case.

In contrast to this, and based on my limited experience so far, it seems that the CUDA_LIB_PATH should use semi-colons when adding the SDK lib dir for use by the linker. Similarly when adding the lib dir to the PATH environment variable (for locating the library at runtime).

I’m guessing that the latter two environment variables are used by Windows and M$ apps and so adhere to the Windows standard, while the CUDA_INC_PATH is parsed by nvcc and so adheres to its own standard, which relies on the comma separator.

Are you using the cuda.rules file that’s in another thread (few months ago) think thats what fixed it for me.

Chris

Nope (see my posting above for my eventual solution). I was loath to modify cuda.rules, since: i) It’s non-standard in the XP world; and ii) It is more opaque to the poor developer, who will typically look at the log file generated by Visual Studio for clues as to what is happening (I’m guessing that the cuda.rules contents aren’t listed there).

If you can think of a reason why cuda.rules is better then I’d be happy to reconsider.

Thanks for you help in any case! :wave:

Hahaha I have the exact same problem on a new machine I’ve just put CUDA on.

How did you get round the problem?

I have the following Environment Variables set (in control panel/system)and i’m using VC 2005.

CUDA_BIN_PATH C:\CUDA\bin
CUDA_INC_PATH C:\CUDA\include, “C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc”
CUDA_LIB_PATH C:\CUDA\lib,“C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib”

'm guessing i’m missing something or I’ve added something wrong!

Cheers,

Chris

I just looked up the details of cuda.rules - this is just a smart way of defining a generic build rules for .cu files - which still passes the include dirs to nvcc using the CUDA_INC_DIR environment variable.

As such, it will still require the “semi-colon-to-comma” fix that I mentioned previously.

I don’t think you need the quotes around your path names - even though they include spaces. If you look at the log output produced by VS2005, you will see that it adds quotes where necessary. This will mean that your quotes will conflict with the VS quotes - e.g. your ‘opening’ quote, will close the first quote added by VS. If this doesn’t make sense, just look at the trace output in the VS log file.

In addition, you will need to add the ‘lib’ dir to your O/S PATH environment variable, so that VS can find the libraries when it runs the application (although you may be able to add it to the list of VS directories from the Tools/Options menu - I’m not sure on this point).

Argument against hacking nvcc.profile, here:

http://forums.nvidia.com/index.php?showtop…ndpost&p=203400

OK I added the following items to the Path variable

C:\CUDA\lib;C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib

but i’m still not getting cutil.h (it’s in the sdk/common/lib).

I tried to bodge it by copying the header into my directory but that(kinda obviously) throws up major problems at the linker stage.

Any ideas?

Chris

Have you tried just setting CUDA_INC_DIR to

C:\CUDA\lib,C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib

Plain and simple like - no quotes or any other fancy stuff.

Also - what errors are you actually getting, and at what stage of the build/execute process?

  • Compile (e.g. headers not found)

    • Link (e.g. library not found)

    • Runtime (another case of library not found)

Ok I added that line to the environment variables. My problem is with the linker:

------ Build started: Project: logsandstuff, Configuration: Debug Win32 ------

Compiling...

tmpxft_00000fc0_00000000-11.i

Linking...

logsandstuff.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function ___cudaUnregisterBinaryUtil

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaLaunch@4 referenced in function ___device_stub_logsandStuff

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaSetupArgument@12 referenced in function ___device_stub_logsandStuff

logsandstuff.obj : error LNK2019: unresolved external symbol ___cudaRegisterFunction@36 referenced in function ___sti___29_tmpxft_00000fc0_00000000_6_ii_65bb9ff7

logsandstuff.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function ___sti___29_tmpxft_00000fc0_00000000_6_ii_65bb9ff7

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaFree@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __imp__cutCompareL2fe@16 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __Z11computeGoldPfS_ii referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __imp__cutDeleteTimer@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __imp__cutGetTimerValue@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __imp__cutStopTimer@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaConfigureCall@32 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __imp__cutStartTimer@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __imp__cutCreateTimer@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaMemcpy@16 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaMalloc@8 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaSetDevice@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaGetDeviceProperties@8 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol _cudaGetDeviceCount@4 referenced in function __Z7runTestiPPc

logsandstuff.obj : error LNK2019: unresolved external symbol __imp__cutCheckCmdLineFlag@12 referenced in function _main

Y:\CUDA\logsandstuff\Debug\logsandstuff.exe : fatal error LNK1120: 20 unresolved externals

oops didn’t mean to hit fast reply

Looks like you’re missing one of the key cuda libraries from your link stage.

From within VS, check the project Properties and go to the Linker/Input section. I’ve got:

cudart.lib cutil32.lib

I suggest you add these if they are missing (note that they are separated by a space).

If they are present, then you could experiment by adding some of the other libs from the CUDA lib dir (although I think most of these are redundant - e.g. FFT libs).

Thanks that was the problem. All working now. Thanks for the help. :)

Cheers,

Chris