I have see a lot of topic and web for a long time about Visual Studio 2008 with how to use OpenCL.
I use Window7 with Athlon 5600+ and HD4870.
I have install 9.11 driver and ati-stream-sdk-v2.0-beta4-vista-win7-64 both of dev and sample. When I use VS i have add 2 directory that is
: c:\Program Files (x86)\ATI Stream\include and
: c:\users\***\Documents\ATI Stream\include too
my code is just
#include <CL/cl.hpp>
int main() {
cl_int err;
cl_uint nReturn;
cl_device_id gId;
err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &gId, &nReturn);
// ERROR here at above
return 0;
}
ERROR is
error LNK2019: unresolved external symbol __imp__clGetDeviceIDs@24 referenced in function _main
and
fatal error LNK1120: 1 unresolved externals
What should I do, Plz help.
Thank for replying.
#include <CL/cl.hpp> int main() { cl_int err; cl_uint nReturn; cl_device_id gId; err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &gId, &nReturn); return 0; }
Have you read my topic for noobs? (including me )
Thank you for your advice.
But now i got a new problem.
I got and error : fatal error LNK1104: cannot open file 'C:\Program.obj'
My $(ATISTREAMSDKROOT) is "C:\Program Files (x86)\ATI Stream"
even I change to "C:\Program Files\ATI Stream" I still got error.
[I have copy ATI Stream folder to Program Files]
Thank you for replying.
Originally posted by: nOzanaix Thank you for your advice.
But now i got a new problem.
I got and error : fatal error LNK1104: cannot open file 'C:\Program.obj'
My $(ATISTREAMSDKROOT) is "C:\Program Files (x86)\ATI Stream"
even I change to "C:\Program Files\ATI Stream" I still got error.
[I have copy ATI Stream folder to Program Files]
Thank you for replying.
n0zanaix,
are you able to compile and run any existing sample coming with installer using Visual studio 2008?
edit existing sample and see you are still facing same problem.
It seems that it is the usual problem of VS2008 with handling Library-Paths with spaces.
Go to the Properties of your project -> then to the linker settings
Then check if in the list of libraries to link against your project there are at least one library with a path that includes one or more spaces (like C:\Program Files\ does). If so, surround this entry with quotes ("). Normally VS2008 also breaks the line if it finds a space character, so check the list carefully.
If you can't find the settings, report it and I will create some screenshots.
Thank you everyone.
I can compile the code now.
But I still don't understand, I add to Additional Dependencies by
>> "C:\Program Files (x86)\ATI Stream\lib\x86\OpenCl.lib" < work
>> "C:\Program Files (x86)\ATI Stream\lib\x86_64\OpenCL.lib" < not work
Thank you.
Originally posted by: nOzanaix Thank you everyone.
I can compile the code now.
But I still don't understand, I add to Additional Dependencies by
>> "C:\Program Files (x86)\ATI Stream\lib\x86\OpenCl.lib" < work >> "C:\Program Files (x86)\ATI Stream\lib\x86_64\OpenCL.lib" < not work
Thank you.
1.) It is better to use only the filename in the "Additional Dependencies"-Dialog under Project-Settings -> Linker -> Input. Set up the Search-directories for this files under Project-Settings -> Linker -> Generel -> Additional Library Directories
2.) I think you compiled your App as a x86 project, so it needs the x86 (32Bit) version of the Lib. If you have an x64 CPU and Windows then VS2008 does not automatically create an x64 Project for you.
To compile it for x64 architecture you have to do the following:
- Project-Settings -> Linker -> Advanced -> Target Machine -> MachineX64
- In the MainMenu choose Build -> Configuration Manager -> Active Solution Platform -> . Under "Type or select the new platform" choose x64 and copy settings from Win32. (Note: x64 is only availabe there if you have installed the x64 Compiler during the VS2008 installation).
Then close the dialog and choose x64 as the platform for your project in the Configuration manager table.
Aditional infos can be found here:
http://blogs.msdn.com/windowssdk/archive/2007/11/13/how-to-add-64-bit-support-to-vcproj-files.aspx
Hey, This make me clear.
Thank you very much.