【发布时间】:2021-07-26 08:27:34
【问题描述】:
我的环境:
Ubuntu clang version 12.0.0-3ubuntu1~20.04.3
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
我的问题: 当我这样做时:
$ clang -cl-std=CLC++ ./test.cl
./test.cl 文件在哪:
template<class T>
T add( T x, T y )
{
return x + y;
}
kernel void k(){}
一个错误提示:
/usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crt1.o: in function _start': (.text+0x24): undefined reference to main'
我想知道如何解决这个问题?我什至无法编译支持 C++ 功能的最简单的 .cl 文件。谢谢大家!
【问题讨论】:
-
如果您只想编译代码,请使用
-c选项 -
感谢您的耐心等待!添加
-c命令后我成功,现在我得到.o文件,我可以使用这个文件通过clCreateProgramWithBinary()创建一个Opencl程序吗?