问题描述
我正在尝试使用以前运行过一次的 NVIDIA 卡在 Ubuntu 上编译 openCL 程序,
I'm trying to compile an openCL program on Ubuntu with an NVIDIA card that worked once before,
我是这样编译的,
我得到了这个结果
但是 nm -D/usr/lib/nvidia-current/libOpenCL.so
告诉我 libOpenCL.so 至少包含 clGetPlatformIDs
but nm -D /usr/lib/nvidia-current/libOpenCL.so
tells me that libOpenCL.so at least contains clGetPlatformIDs
我是不是遗漏了什么.
推荐答案
来自 gcc
手册页:
因此尝试在编译命令中的文件参数之后指定 -lOpenCL
.
So try to specify the -lOpenCL
after the file argument in your compile command.
您还可以在 libOpenCL.so 中搜索符号,这是一个共享库文件.使用您的命令,您将程序再次链接到静态库,格式为 libOpenCL.a
.
You also search for symbols in libOpenCL.so, which is a shared library file. With your command you link your program agains a static library, in the format libOpenCL.a
.
这篇关于库已链接但引用未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!