How to integrate OpenCL with Visual Studio 2008 help needed

Hi,

Is there any tutorial presenting how to integrate openCL with Visual Studio??

I’ve tried lots of stuff to do, but nothing helped me. I’ve installed cudatoolkit and gpu computing sdk properly, cause all the tutorials includd works.

i’ve set system variables :

$OPENCL_INC - pointing to

C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\OpenCL\common\inc;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\shared\inc

and

$OPENCL_LIB - pointing to

C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\OpenCL\common\lib;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\OpenCL\common\lib\Win32;C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\shared\lib

in visual studio i’ve set in tools->options->project directories

on Includes and Liblaries appropriate system paths

and with a simple code :

[codebox]#include

#include <Cl/opencl.h>

#include <oclUtils.h>

int main(int argc, char *argv) {

cl_int err;

cl_platform_id pl;

err = oclGetPlatformID(&pl);

std::cout<<err<<std:endl;

return 0;

}[/codebox]

all i get is multiple errors :

Linking…

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: “public: class std::basic_ostream<char,struct std::char_traits > & __thiscall std::basic_ostream<char,struct std::char_traits >::operator<<(class std::basic_ostream<char,struct std::char_traits > & (__cdecl*)(class std::basic_ostream<char,struct std::char_traits > &))” (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z) already defined in oclUtils32D.lib(shrUtils.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: “public: class std::basic_ostream<char,struct std::char_traits > & __thiscall std::basic_ostream<char,struct std::char_traits >::operator<<(int)” (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z) already defined in oclUtils32D.lib(shrUtils.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: “class std::basic_ostream<char,struct std::char_traits > & __cdecl std::endl(class std::basic_ostream<char,struct std::char_traits > &)” (?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z) already defined in oclUtils32D.lib(shrUtils.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: “public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)” (?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in oclUtils32D.lib(shrUtils.obj)

1>libcpmtd.lib(ios.obj) : error LNK2005: “private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)” (?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libcpmtd.lib(ios.obj) : error LNK2005: “public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)” (?_Addstd@ios_base@std@@SAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libcpmtd.lib(locale0.obj) : error LNK2005: “void __cdecl _AtModuleExit(void (__cdecl*)(void))” (?_AtModuleExit@@YAXP6AXXZ@Z) already defined in msvcprtd.lib(locale0_implib.obj)

1>libcpmtd.lib(locale0.obj) : error LNK2005: __Fac_tidy already defined in msvcprtd.lib(locale0_implib.obj)

and so on

where is there a problem

can anyone help me ??

try to open in the SDK the project on VectorAdd for example and just take the same options

The main problem is incorporating all the libraries and header files into your project. I believe the easiest solution is to open one of Nvidia’s projects and work from there, as jonathan81 has suggested. Merely make a copy of one of the projects, such as oclVectorAdd, and play around with it. In Project Settings, I was even able to change it from a console into a windows application. However, if you wish to create your own project from scratch, for whatever absurd reason it is, you should be able to find appropriate instructions in the ‘OpenCL SDK Release Notes’ (it will tell you which header files and libraries are required to have your OpenCL program up and running).


DD STOSIC

thanks for reply :) as you sugested i’ve taken one of the samples and changed it to fit my goal :)