[英]Cl has no member vector
I'm trying to write a Hello World application using the AMD implementation of OpenCL. 我正在尝试使用OpenCL的AMD实现编写Hello World应用程序。 http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/introductory-tutorial-to-opencl/ http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/introductory-tutorial-to-opencl/
I've setup the directory, lib, etc. as here 我设置的目录,LIB,等这里
The following compiles: 以下编译:
#include "stdafx.h"
#include <CL/cl.h>
int _tmain(int argc, _TCHAR* argv[])
{
cl_platform_id test;
cl_uint num;
cl_uint ok = 1;
clGetPlatformIDs(ok, &test, &num);
return 0;
} }
However, 然而,
#include "stdafx.h"
#include <utility>
#include <CL/cl.hpp>
int _tmain(int argc, _TCHAR* argv[])
{
cl::vector< cl::Platform > platformList;
return 0;
}
does not. 才不是。
I get the following errors: 我收到以下错误:
Error 1 error C2039: 'vector' : is not a member of 'cl' D:\Documents\Projects\Visual Studio\C++\cl_helloworld\cl_helloworld\cl_helloworld.cpp 12 1 cl_helloworld
Error 2 error C2065: 'vector' : undeclared identifier D:\Documents\Projects\Visual Studio\C++\cl_helloworld\cl_helloworld\cl_helloworld.cpp 12 1 cl_helloworld
Error 3 error C2275: 'cl::Platform' : illegal use of this type as an expression D:\Documents\Projects\Visual Studio\C++\cl_helloworld\cl_helloworld\cl_helloworld.cpp 12 1 cl_helloworld
Error 4 error C2065: 'platformList' : undeclared identifier D:\Documents\Projects\Visual Studio\C++\cl_helloworld\cl_helloworld\cl_helloworld.cpp 12 1 cl_helloworld
IntelliSense underlines vector< cl::Platform > platformList
, and when i type cl:: I cannot see a vector class. IntelliSense强调vector< cl::Platform > platformList
,当我输入cl :: I时,我看不到向量类。
EDIT 编辑
If I manually copy the content of the cl.hpp to the main.cpp, I see vector in IntelliSense, but still cannot compile the project. 如果我手动将cl.hpp的内容复制到main.cpp,我在IntelliSense中看到了vector,但仍然无法编译项目。
Use std::vector<cl:XXXX>
instead. 请改用std::vector<cl:XXXX>
。 That is what I use, no problem at all atm, and I have very complex OpenCL C++ apps. 这就是我使用的,没有任何问题,我有非常复杂的OpenCL C ++应用程序。
You can also enable the internal cl::vector
class by defining before the #include <cl.hpp>
#define __NO_STD_VECTOR
. 您还可以通过在#include <cl.hpp>
#define __NO_STD_VECTOR
之前定义来启用内部cl::vector
类。 But I don't recomend it , since the functionality is poorer than std. 但我不推荐它 ,因为功能比std更差。
Example: If you have a vector of events, in std you can remove the events selectively. 示例:如果您有事件向量,则在std中可以有选择地删除事件。 But in cl::vector you have to do it manually. 但是在cl :: vector中你必须手动完成它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.