Linking against a CUDA .obj in Visual Studio 2005

Alright, so I’ve got a small CUDA code snippit compiling fine, but I’m trying to call it from another file and I’m getting a linker error.

The normal:

error LNK2001: unresolved external symbol “void __cdecl doStuff(void)” (?doStuff@@YAXXZ)

I’ve got my CUDA file (containing void doStuff())

test.cu

compiling fine into a test.obj, but my other file can’t seem to find it. I figure, it’s just that even though it is generated the test.obj, it isn’t ever actually told to link it. Not 100% certain, but that’s the best that I could come up with.

The CUDA portion is building which I guess is half the battle, but I can’t seem to get the rest of my program to see it.

If this is a common problem for beginners can someone let me know what I have to do to make it link against that object file? Even if I have to do something to the specific properties of the files that’s calling the function inside it that’s fine.

If you need more information to analyze the problem just let me know what you need me to provide and I will.

.cu files are “C” language files. You need to declare functions extern “C” to call from c++ source code.

You are probably right on the money, I thought of this too, about 5 minutes after I laid down to go to bed last night. After wasting about two hours staring at it.

Thank you very much though.

Cool, it works now (well, runs) , thanks again.