cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

ankurdh
Journeyman III

Context Properties doubt

Consider the following code:

using namespace cl;

int main(){

vector<Platform> platforms;

cl_int err = Platform::get(&platforms);

vector<Platform>::iterator itr = platforms.begin();

cl_context_properties cps = {

CL_CONTEXT_PLATFORM,

(cl_context_properties)(*itr)(),

0

};

/*

* rest of the code. . 

*/

 

Now, what i want to know is, int the line

(cl_context_properties)(*itr)()

what do the last pair of paranthesis do?

i tried (cl_context_properties)(*itr). It didn't work. 

*itr a Platform type object rite? So, does that last pair of parenthesis mean that we are calling the default constructor of that Platform object?

if yes, why should we do that? We need a variable of type 

cl_platform_id rite?

Thats what the manual says!

 

0 Likes
12 Replies
ankurdh
Journeyman III

main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall streamsdk::SDKFile:pen(char const *)" (?open@SDKFile@streamsdk@@QAE_NPBD@Z) referenced in function _main

1>C:\Users\Ankur\Documents\Visual Studio 2008\Projects\FirstOpenCLC++\Debug\FirstOpenCLC++.exe : fatal error LNK1120: 1 unresolved externals



i'm getting this error in the line:

streamsdk::SDKFile kernelFile;

kernelFile.open("MyFirstKernel.cl");

 

any idea anyone?

0 Likes

Are you linking SDKUtil.lib? It looks like you have included but not linking

0 Likes

sir, may i kno how to link SDKUtil.lib?

0 Likes

Add the name of the lib in Properties-> Linker -> Input -> Additional Dependencies

Provide the path to the .lib file at Properties-> Linker -> General -> Additional Library Directories  

0 Likes
genaganna
Journeyman III

Originally posted by: ankurdh Consider the following code:

using namespace cl;

int main(){

vector platforms;

cl_int err = Platform::get(&platforms);

vector::iterator itr = platforms.begin();

cl_context_properties cps = {

CL_CONTEXT_PLATFORM, (cl_context_properties)(*itr)(), 0 };

/* * rest of the code. .  */ Now,

what i want to know is, int the line

(cl_context_properties)(*itr)()

what do the last pair of paranthesis do?

i tried (cl_context_properties)(*itr). It didn't work. 

*itr a Platform type object rite?

So, does that last pair of parenthesis mean that

we are calling the default constructor of that Platform object?

if yes, why should we do that? We need a variable of type cl_platform_id rite? Thats what the manual says!



Please see iterator class in cl.hpp.

 

 

0 Likes

@genaganna

I already have $(ATISTREAMSDKROOT)/lib/x86

in the additional library dependancy list. 

still not working.

we want to demonstrate use of GPU to run programs using OpenCL in our final year of engineering. 

Can u please tell me the steps i need to take to write openCL programs in Eclipse C++ IDE? Somehow MS VC++ . . i'm not that comfortable. . 

Or is ther any OpenCL Eclipse Plugin or somthing? 

 

0 Likes

Originally posted by: ankurdh @genaganna

 

I already have $(ATISTREAMSDKROOT)/lib/x86

 

in the additional library dependancy list. 

 

still not working.

 

we want to demonstrate use of GPU to run programs using OpenCL in our final year of engineering. 

 

Can u please tell me the steps i need to take to write openCL programs in Eclipse C++ IDE? Somehow MS VC++ . . i'm not that comfortable. . 

 

Or is ther any OpenCL Eclipse Plugin or somthing? 

 

 

 

 

If you want to work under Eclipse then you need to use Ubuntu 9.04 and install the latest 9.12 hotfix and ati stream sdk 2.0 for linux. ATM you can't use GCC+Eclipse under Windows (or better, you can do it but you have to modify some OpenCL headers provided by the SDK, which is not a good idea if you're not an expert).

0 Likes

I downloaded the MinGW compiler for Eclipse C++ IDE. It doesn come with a compiler. And i added all the OpenCL required libraries in the library and include folder of the MinGW compiler folder. And things started to work. . All openCL calls were getting called . But then , i learnt that the header cstdlib in MinGW doesn has the alloca() definition. Neither in malloc.h. I tried to download cygwin. Ther was some problem to download it. 

So, i had to switch back to MSVC++. How do we specify multiple additional dependencies in it?

In ProjectProperties->Linker->input->Additional dependencies, i've already put OpenCL.lib. Ther is no way that i can add another one in it SDKUtil.lib. The compiler gave errors when i added both the .lib files comma separated. i tried with semi colon between them . and tried with a space also. . nothing worked. . 

How can i add both the .lib files there?

 

0 Likes

You can add two libraries with a space in between them. What is the error you are getting when you are adding this way?

0 Likes

1>Compiling...

1>main.cpp

1>Linking...

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::size(void)const " (?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static bool __cdecl std::char_traits<char>::eq_int_type(int const &,int const &" (?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static int __cdecl std::char_traits<char>::eof(void)" (?eof@?$char_traits@D@std@@SAHXZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const " (?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::tie(void)const " (?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in SDKUtil.lib(SDKFile.obj)

1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in SDKUtil.lib(SDKFile.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 SDKUtil.lib(SDKFile.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)

1>libcpmtd.lib(locale0.obj) : error LNK2005: "private: static void __cdecl std::locale::facet::facet_Register(class std::locale::facet *)" (?facet_Register@facet@locale@std@@CAXPAV123@@Z) already defined in msvcprtd.lib(locale0_implib.obj)

1>libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libcpmtd.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_ctor(class std::_Locinfo *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &" (?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libcpmtd.lib(locale0.obj) : error LNK2005: "public: static void __cdecl std::_Locinfo::_Locinfo_dtor(class std::_Locinfo *)" (?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in msvcprtd.lib(MSVCP90D.dll)

1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)

1>LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)

1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)

1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)

1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)

1>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)

1>LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRTD.lib(MSVCR90D.dll)

1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library

1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

1>C:\Users\Ankur\Documents\Visual Studio 2008\Projects\FirstOpenCLC++\Debug\FirstOpenCLC++.exe : fatal error LNK1169: one or more multiply defined symbols found

1>Build log was saved at "file://c:\Users\Ankur\Documents\Visual Studio 2008\Projects\FirstOpenCLC++\FirstOpenCLC++\Debug\BuildLog.htm"

1>FirstOpenCLC++ - 51 error(s), 2 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



 

This is the error list!! 

0 Likes

http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=120763&STARTPAGE=2&FTVAR_FORUMVIEWTMP=Linear

last three posts should do it for you.

0 Likes

@gamervivek: Thanks buddy. . that worked for me . 

@all: Thank you everyone. It worked for me. i jus changed code generation to multi threaded dubug .  . And it worked . 
 

0 Likes