View Full Version : I can't Compile simple OpenCL program.
Atak_Snajpera
4th March 2016, 13:22
I'm trying to compile this simple example
http://dhruba.name/2012/08/14/opencl-cookbook-listing-all-devices-and-their-critical-attributes/
in VS 2013.
Here what I've done so far
1) installed AMD APP SDK 3.0
2) manually copied all files from
C:\Program Files (x86)\AMD APP SDK\3.0\include\CL
to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\CL
and here where I stuck
http://i.cubeupload.com/DTPNxI.png
I'm total noob here so please forgive me if I've forgotten about something simple and obvious for you ;)
Groucho2004
4th March 2016, 14:07
LNK2019 usually indicates a missing library (.lib) with which the project needs to be linked. Maybe one of the OpenCL libs?
Atak_Snajpera
4th March 2016, 14:35
Ok. I've also copied all files from C:\Program Files (x86)\AMD APP SDK\3.0\lib\x86
to
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib
http://i.cubeupload.com/zoHoVE.png
and still the same error.
Groucho2004
4th March 2016, 14:45
Google your specific error.
nevcairiel
4th March 2016, 14:51
Just copying the libraries some place doesn't cause your project to link to them, you need to tell it specifically which libraries to pull in for linking.
Atak_Snajpera
4th March 2016, 14:57
Ok. Problem solved.
This helped me to correctly set-up VS for OpenCL
http://kode-stuff.blogspot.com/2012/11/setting-up-opencl-in-visual-studio_1.html
LoRd_MuldeR
4th March 2016, 17:48
2) manually copied all files from
C:\Program Files (x86)\AMD APP SDK\3.0\include\CL
to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\CL
Bad idea! Don't mess up your compiler's include directory by "throwing in" foreign headers. Instead, just add "C:\Program Files (x86)\AMD APP SDK\3.0\include" to the include path for the particular Projects that needs it ;)
In VisualStudio you can do this under the Project's settings via "C++" -> "General" -> "Additional Include Directories".
To make your Project file independent from a particular machine, I would even recommend to use an environment variable instead of a hard-coded path in there. You can use $(SOME_ENV_VAR) in your include path specification.
It's actually quite possible the AMD SDK already has created such an environment variable during installation...
Ok. I've also copied all files from C:\Program Files (x86)\AMD APP SDK\3.0\lib\x86
to
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib
Same as above. Don't mess up your compiler's lib directory. Just add an additional library search path to the project.
Atak_Snajpera
4th March 2016, 21:06
Do not worry Lord I've deleted all files which I copied manually :)
Everything is working fine now :)
Ps. Like I said I'm total noob in VS.
minaust
8th March 2016, 18:16
Do not worry Lord I've deleted all files which I copied manually :)
Everything is working fine now :)
Ps. Like I said I'm total noob in VS.
Heh-heh. I"ve been using VS ever there's been such a thing, and I'm still a noob. Seems that every time a new version comes out you've got to learn it all over again.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.