I work on a project and I must link the OpenCL library on Windows.
When I use the QtCreator to add it (right click on project, in project tree/Add library), I get error “LNK2019: unresolved external symbol clGetPlatformID”
The .pro file looks like this:
win32: LIBS += -L$$PWD/../../../../../Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/Win32/ -lOpenCL
INCLUDEPATH += $$PWD/../../../../../Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/Win32
DEPENDPATH += $$PWD/../../../../../Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/include
win32: PRE_TARGETDEPS += $$PWD/../../../../../Program Files/NVIDIA GPU Computing --Toolkit/CUDA/v5.0/lib/Win32/OpenCL.lib
Also, I tried a different approach: I copied the OpenCL folder to C:\opencl because I thought that the white spaces in the file path may cause problems, but I still get the same errors.
The .pro file for this approach looks like this:
win32:CONFIG(release, debug|release): LIBS += -Lc:/opencl/lib/Win32 -lOpenCL
else:win32:CONFIG(debug, debug|release): LIBS += -Lc:/opencl/lib/Win32 -lOpenCL
INCLUDEPATH += c:/opencl/include
DEPENDPATH += c:/opencl/include
Another problem I get is when I try to include <CL/cl.h>.
C1083: Cannot open include file: 'CL/cl.h': No such file or directory.
I fixed this by copying the cl.h in the project, but this isn’t the best way.
Any ideas of how to fix this?
↧