gcc和CUDA问题
你好,
我已经编译了一个CUDA共享库,但无法将其与使用它的主程序链接在一起。我正在使用gcc编译主程序。
代码:
simplemain.c
#include <stdio.h>
#include <stdlib.h>
void fcudadriver();
int main()
{
printf("Main \n");
fcudadriver();
return 0;
}
test.cu
__global__ void fcuda()
{
}
void fcudadriver()
{
fcuda<<<1,1>>>();
}
我编译 test.cu 为 --> 它可用
nvcc --compiler-options '-fPIC' -o libtest.so --shared test.cu
我编译simplemain.c文件,结果出错了 :(
gcc simplemain.c -L. -ltest
/tmp/ccHnB4Vh.o:simplemain.c:function main: error: undefined reference to 'fcudadriver'
collect2: ld returned 1 exit status