linker errors

hi, i’ve done a .cu file with some functions but when i compile it gives me linker errors where i call them in my cpp application…

sacf.obj error LNK2019: unresolved external symbol _correlogramFrame referenced in function “void __cdecl Sacf(double ,double ,double ( const)[5],double ( const)[2048])” (?Sacf@@YAXPAN0QAY04NQAY0IAA@N@Z)
1>Sacf.obj : error LNK2019: unresolved external symbol _LyonPassiveEarCUDA referenced in function

i already have another .cu file and i have no problem calling functions from that one …

the new .cu file includes his .h file which includes the .h file of my other .cu…

what can be the problem?

Did you use C linkage when you declared the functions in your header? Otherwise C++ will think they’re C++ functions with C+±style name mangling and won’t be able to find the C function in link phase (at least I think that’s what causes it…see some of the samples in the SDK, cppIntegration is a good example of this (main in the cpp file, calling a function in a .cu file).

Hope that helps!


Edit: Unless, of course, you’re compiling with the nvcc flag --host-compilation=c++ which would invalidate the remainder of this post.

hi, thanks for the reply.

i have declared my functions in the .h file as:

extern “C” void correlogramFrame(double h_data[120][2048], int picWidth, int start, double *h_out);

which is how cppintegration shows. as i said i have no problem calling from a different .cu file and i used the same header syntax…