我一直在尝试OpenCL
在C++
文件中使用。当我尝试编译它时,它给出了很多LNK2019错误,例如:
函数“ public:static int __cdecl cl :: Platform :: get(class std :: vector> *)”中引用的未解析的外部符号_clGetPlatformIDs @ 12”(?get @ Platform @ cl @@ SAHPAV?$ vector @ VPlatform @ cl @ @V?$ allocator @ VPlatform @ cl @@@ std @@@ std @@@@ Z)
在Platform
类中定义的cl.hpp
,它使用clGetPlatformIds
,在定义cl.h
但没有付诸实施。我认为这就是问题所在。如何使代码正常工作?(我有24个未解决的外部符号)
LNK2019
是Microsoft Visual Studio错误。#pragma comment(lib, "OpenCL.lib")
在您的来源中添加行。您还应该在项目选项中指定库文件的路径:Project/ Properties/ Configuration Properties / VC++ Directories / Library Directories
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句