Hi everyone,
I’m trying to compile the following (veeery) simplified version of a project i’m on:
// file cuda.cu
global f1
global f2
…
global fn
extern “C” {
int myCudaFunc ( … )
{
// defined by other.c
function_other( … )
// other code
....
launchKernel <<< ... >>> ( ... )
....
}
// end of cuda.c
// file cpu.c
…
myCudaFunc ( … )
…
// end of cpu.c
// file others.c
…
sth function_other( … )
{
…
// glib function
a_glib_function()
…
}
…
// end of others.c
More or less that’s it.
Now I compile everything using the appropriate libraries so that cuda.o, cpu.o and others.o are produced.
The point is that when I try to link everything altoghether using gcc (or g++, doesn’t matter) an
“undefined reference to function function_other( … ) in myCudaFunc ( … )”
happens. The other functions, instead, seem to be seen correctly, as this is the only error happening at all.
Please take into account that the environment variables are correctly set as of cuda manual 3.0 and during linking phase all libraries (cuda, and glib, notably) and their header folders are passed as parameters to gcc
Thanks to everyone :D
Riccardo