Я пытаюсь написать приложение Hello World с использованием AMD OpenCL. http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/introductory-tutorial-to-opencl/Cl не имеет вектора-члена
Я настроить каталог, Пб и т.д. as here
следующие компилирует:
#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;
}
Однако
#include "stdafx.h"
#include <utility>
#include <CL/cl.hpp>
int _tmain(int argc, _TCHAR* argv[])
{
cl::vector<cl::Platform> platformList;
return 0;
}
нет.
я получаю следующие ошибки:
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 подчеркивает vector<cl::Platform> platformList
, и когда я типа кл :: Я не могу видеть вектор класса.
EDIT
Если я вручную скопировать содержимое cl.hpp в main.cpp, я вижу вектор в IntelliSense, но до сих пор не может скомпилировать проект.
Просто угадать, потому что я не знаю OpenCL ... но должен ли 'cl :: vector' быть' cl :: Vector' или 'std :: vector' вместо этого? – cHao
В соответствии с примером, я должен #define __NO_STD_VECTOR // Использовать cl :: vector вместо STL-версии, но у меня все еще есть ошибки. std :: vector работает, но мне нужно использовать cl :: vector. – otisonoza
Согласно спецификации, 'cl :: vector' устарел в пользу' std :: vector' или вашего собственного типа вектора, который трясет как 'std :: vector'. (http://www.khronos.org/registry/cl/specs/opencl-cplusplus-1.2.pdf, раздел 5) – cHao