Reputation: 229
I am having serious trouble taking my first steps in Opencl, primarily because my compiler either refuses to recognize the existence of the relevant libraries. I downloaded the latest version of the AMD SDK from their website and went with the full install. I'm wanting to learn through this blog, so much of my information is derived from there.
First off, I've checked my system path variable and it has the 64 bit bin folder of the amd api included.
I started off trying to compile using a make file with the apparently standard option -lOpenCl
but it simply told me that it could not find -lOpenCl or CL\cl.hpp. So I then added -I %AMDAPPSDKROOT%\include
which fixed half my problem, yet still (three hours and counting) the compiler complains about undefined references while refusing to recognize any of the relevant libraries.
g++ -std=c++1y -g -o .\bin\test.exe .\quicktest.cpp -I .\Libraries -I .\Scource -I "%AMDAPPSDKROOT%\include" -L "%AMDAPPSDKROOT%\bin\x86_64" -L "%AMDAPPSDKROOT%\lib\x86_64" -LlibOpenCl.a
is the command I am compiling with right now, and it has vanquished all issues but the undefined references to functions like clGetPlatform
and clReleaseCommandQueue
. I am using the exact same code as the first example in the OpenCl blog except I've also included vector
.
I've tried a load of different combinations, and suggestions from the internet but nothing has worked so far. Is there something I am missing / don't understand? I would really like to move ahead with my learning and would deeply appreciate any help.
To be honest, I do not know exactly what information would be helpful, but if it helps I am running a 64 bit windows 7 computer with a Geforce GT 635 and I have both CUDA and the AMD SDK installed.
Upvotes: 0
Views: 319
Reputation: 229
g++ -std=c++1y -g -o .\bin\test.exe .\quicktest.cpp -I .\Libraries
-I .\Scource -I "%AMDAPPSDKROOT%\include" "%AMDAPPSDKROOT%\lib\x86\libOpenCl.a"
%AMDAPPSDKROOT%\lib\x86\libOpenCl.a
by specifying the full file path and including the file with the same semantics as if it were an object file I got my project to compile, I also used the 32 bit version of the libraries instead of the 64 bit version.
Upvotes: 0
Reputation: 81
looking at how you are compiling it seems that -LlibOpenCl.a is wrong. -L is used for library directories while -l is used for single libraries. To use -l you have to remove the lib in front of the library name and remove whats after the dot. In your case it should be -lOpenCl as you stated at the beginning.
Is libOpenCl in one of these two directories ? : %AMDAPPSDKROOT%\bin\x86_64 %AMDAPPSDKROOT%\lib\x86_64
I suppose the first one is for the binaries and he second one for the libraries so the first one should be useless. You get undefined references during linking since you are still not linking the library.
Upvotes: 3