Cl没有成员向量

oti*_*oza 3 c++ gpu opencl visual-studio-2012 amd-processor

我正在尝试使用OpenCL的AMD实现编写Hello World应用程序. http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/introductory-tutorial-to-opencl/

我设置的目录,LIB,等这里

以下编译:

#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;
Run Code Online (Sandbox Code Playgroud)

}

然而,

#include "stdafx.h"

#include <utility>
#include <CL/cl.hpp>


int _tmain(int argc, _TCHAR* argv[])
{
    cl::vector< cl::Platform > platformList;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

才不是.

我收到以下错误:

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
Run Code Online (Sandbox Code Playgroud)

IntelliSense强调vector< cl::Platform > platformList,当我输入cl :: I时,我看不到矢量类.

编辑

如果我手动将cl.hpp的内容复制到main.cpp,我在IntelliSense中看到了vector,但仍然无法编译项目.

Dar*_*ros 6

std::vector<cl:XXXX>改用.这就是我使用的,没有任何问题,我有非常复杂的OpenCL C++应用程序.

您还可以cl::vector通过在之前定义来启用内部类#include <cl.hpp> #define __NO_STD_VECTOR.但我不推荐它,因为功能比std更差.

示例: 如果您有事件向量,则在std中可以有选择地删除事件.但是在cl :: vector中你必须手动完成它.