我正在遵循此guide在Windows 7下为Qt5编译OpenCV。 我正在使用:
我已按照说明配置并设置了参数。然后开始编译。它失败并出现许多类似的错误:
C:\opencv\sources\modules\core\src\directx.cpp:1055:5: error: 'cl_context' was not declared in this scope
cl_context context = (cl_context)ctx.ptr();
^~~~~~~~~~
C:\opencv\sources\modules\core\src\directx.cpp:1055:5: note: suggested alternative: '_onexit'
cl_context context = (cl_context)ctx.ptr();
^~~~~~~~~~
_onexit
C:\opencv\sources\modules\core\src\directx.cpp:1057:5: error: 'cl_int' was not declared in this scope
cl_int status = 0;
^~~~~~
C:\opencv\sources\modules\core\src\directx.cpp:1057:5: note: suggested alternative: 'lrint'
cl_int status = 0;
^~~~~~
lrint
C:\opencv\sources\modules\core\src\directx.cpp:1058:12: error: expected ';' before 'clImage'
cl_mem clImage = 0;
^~~~~~~
C:\opencv\sources\modules\core\src\directx.cpp:1062:5: error: 'clImage' was not declared in this scope
clImage = clCreateFromD3D11Texture2DNV(context, CL_MEM_WRITE_ONLY, pD3D11Texture2D, 0, &status);
^~~~~~~
C:\opencv\sources\modules\core\src\directx.cpp:1062:5: note: suggested alternative: 'IplImage'
clImage = clCreateFromD3D11Texture2DNV(context, CL_MEM_WRITE_ONLY, pD3D11Texture2D, 0, &status);
^~~~~~~
IplImage
C:\opencv\sources\modules\core\src\directx.cpp:1062:44: error: 'context' was not declared in this scope
clImage = clCreateFromD3D11Texture2DNV(context, CL_MEM_WRITE_ONLY, pD3D11Texture2D, 0, &status);
^~~~~~~
C:\opencv\sources\modules\core\src\directx.cpp:1062:44: note: suggested alternative: 'onexit'
clImage = clCreateFromD3D11Texture2DNV(context, CL_MEM_WRITE_ONLY, pD3D11Texture2D, 0, &status);
^~~~~~~
onexit
C:\opencv\sources\modules\core\src\directx.cpp:1062:53: error: 'CL_MEM_WRITE_ONLY' was not declared in this scope
clImage = clCreateFromD3D11Texture2DNV(context, CL_MEM_WRITE_ONLY, pD3D11Texture2D, 0, &status);
我在CMake中禁用了WITH_DIRECTX
标志,然后:
mingw32-make clean
mingw32-make -j 8
但是错误仍然存在。 我还必须做些什么来解决此问题?
答案 0 :(得分:1)
要禁用DirectX,我还必须关闭与OpenCL相关的所有项目:
了解OpenCL与DirectX相关并不是那么简单。