Embarrassing: Hello World no go

Hi all,

thought had prepared VERY well and circumnavigated pitfalls in advance after watching GTC2010 MS Parallel Nsight and Jason Sanders CUDA C tutorials - and I´m really not that bad in VS 2010 and VC++, but so far NOTHING works.

#include <cstdio>using std::printf; int main(void){  printf("Hello World\n");  return 0;}

error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4

Some Windows 7 x64 problem when I build Debug Win32 in VS 2010 Pro?

I did Build Customisations CUDA and Project Item Props CUDA C/C++.

CUDA by Example Chapter08 ripple wants GLUT32.lib… MS guy in video cut some corner when it didn´t link and resorted to a canned proj.

Stopped in frustration

Thx G.

PS: Put the code brackets around, but doesn´t format. Bad day. Giving up.

Sorry to hear that you are having a frustrating experience. I am no Windows wizard (more of a Linux person), but what I think is being reported as an unresolved symbol is a hook for the execution of device code (code executing on the GPU) that gets emitted whenever nvcc compiles a .cu file, apparently even if the .cu file contains just host code (code executing on the CPU) as in your case.

In general, .cu files contain a mixture of host code and device code, and this hook is needed to invoke device kernels from host code. It seems to me you would have to link with the CUDART library to resolve the reference, but I do not off-hand know how one would do that under Windows.

Formatting of code should be preserved as written inside (code),(/code) blocks. Note I used parentheses instead of the square brackets used by actual commands as I do not know how to preserve the square brackets.

#include <cstdio>

using std::printf;

int main(void) 


   printf("Hello World\n");

   return 0;


Thanks for your input, njuffa,

after I unsuccessfully tried in VS2010 by altering some parameters (switching to a x64 exe; adding Lib and Include paths,… to the CUDA_by_Example Chapter03 hello_world.cu and Chapter08 ripple.cu examples) I took a step back and tried VS x64 command line envi.

Like magic the proverbial “Hello World” example (albeit w/o any CUDA code ) compiled.

Need to take a closer look at the Chapter03 hello_world.cu from CUDA_by_Example.

Even with CUDA_by_Example as current dir

nvcc -Llib -Icommon chapter03\hello_world.cu

results in 1 error: identifier “IUnknown” is undefined.

Re source formatting: You could have seen from the bounding box that I DID use (code) (/code) brackets, but the code copied from VS changed to one line anyway. Didn´t have / take the time / patience to tinker…

Would have been nice if an NVIDIA insider had had a clue what the real problem with compile INSIDE VS is, resulting in

error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4

AFAIK a FatBinary in CUDA-talk is host+device-code, so maybe adding some device code…

We´ll see what the rest of the day holds…


Next day…
Slowly I begin to wonder who´s to be embarrassed: Me, NVIDIA or MS?

After just a little experimentation (opening the 3 mentioned projects, edits in VS2010 and NVCC in VS x64 cmd line envi with the simplest possible no-cuda-hello_world.cu and chapter03/hello_world.cu and 08/ripple.cu) the whole thing was so f***ed up that it didn´t even compile no-cuda-hello_world.cu. (error: identifier “IUnknown” is undefined)

I know I restarted VS the one or other time, but not the cmd-line envi, because I hadn´t batched the dir and cmd setup.

This is a no-mess Win7 machine and an almost untouched b4 VS2010, all fully patched with CUDA and Intel OpenCL SDK 1.5 added.

TWENTY YEARS AGO on Compuserve I used to see ANSWERS (right on the spot). When I Google for the IUnknown-error I just find WILD GUESSES.


If you ever look for a Hello World example that RRREALLY includes everything - including #includes and var declarations - AND compiles in VS 2010 - AND WORKS AS ADVERTISED, even if it´s not THAT basic (Thrust), then go to Ade Miller´s Tech blog at

Next step will be to analyze what the other would-be step-by-step CUDA Hello Worlds are missing that none actually works in VS.

BTW: Just tried to add some (code) and the editing box went nuts. Couldn´t paste the last copy from WordPad. Somehow it seemed the second but last text I had copied from VS.

There seem to be major CR, LF or CR / LF issues - which I suspected and is nothing new. When I copied Ade´s code from IE, CRs were gone in VS and Editor, but there in WordPad. When I copy & paste from WordPad, CRs double or triple here.

Will do some further investigation in an extra post.


Good day! (double meaning)

I think an NVIDIA official in this very specialized forum should be able to tell from the provided error message (error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4
) in the most basic of basic examples that a cudart.lib (CUDA RunTime lib) is missing in Project / Properties / Linker / Input / Additional Dependencies!

I don´t think Jason Sanders MS´ Guy Rich NVIDIA´s Kumar Iyer (who had taken over from Guy) mentioned this essential step in his 2245_GTC2010 Parallel Nsight & VS CUDA C talk, just remember Build Customizations / CUDA 4.0 target, props and .cu-file Properties / Configuration Properties / General / Item Type / CUDA C / C++.

Upon review Jason Sanders in his GTC2010 CUDA C didn´t talk about VS at all, but did a nice GPU computing principles overview.

Kumar Iyer did a very enlightening talk, but cut a corner at 41:07. “Great, it compiles.” “Minor” issue: It didn´t link.

He talked about adding cudart.DLL to the out dirs in an after-build step, which puzzles me, cuz the linker needs the LIB!?!?

After adding the cuda_by_example-path lib\glut64.lib in Project / Properties / Linker / Input / Additional Dependencies in addition to cudart.lib (file name only, path already in envi-var) for x64 and glut32 repsectively I could build both platforms!!!

I don´t have the time to check if it was essential (too) that I added the x64 Platform as the build target. Don´t think too many CUDA devs use x86 Windows these days. Win32 on WoW normally is not an issue, but it might be with CPU / GPU Fat binaries. Don´t rack your brains too much to give a definite answer to that one. See above. Both, Win32 and x64 built and ran on Win7 64!