我想使用nVIDIA编译器生成一个共享库,供我的GNU编译器链接。在运行之前,一切都很顺利。以下是详细信息。谢谢!
main.cpp:
#include <iostream>
using namespace std;
void fcudadriver();
int main()
{
cout<<"Maine "<<endl;
fcudadriver();
return 0;
}test.cu:
__global__ void fcuda()
{
}
void fcudadriver()
{
fcuda<<<1,1>>>();
}编译:
nvcc --compiler-options '-fPIC' -o libtest.so --shared test.cu
g++ main.cpp -L. -ltest运行:
./a.out结果:
./a.out: error while loading shared libraries: libtest.so: cannot open shared object file: No such file or directory发布于 2012-04-06 22:41:39
运行时链接器的LD_LIBRARY_PATH中必须有.,才能找到共享库。
尝试:
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./a.outhttps://stackoverflow.com/questions/10044987
复制相似问题