cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

arunabha
Journeyman III

Problem compilling Hello World from the commandline

Hi,

    I'm trying to compile a simple HelloWorld app using the intro tutorial at http://developer.amd.com/sdks/AMDAPPSDK/documentation/pages/TutorialOpenCL.aspx

I also read http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=128133 which discusses some of the same issues.

The problem I'm getting is that the linker is unable to find a reference. I'm attaching the code and the build command is given below.

 

cl /Fehello_world.exe /EHsc /I"c:\Program Files (x86)\AMD APP\include" hello.cpp "c:\Program Files (x86)\AMD APP\lib\x86_64\OpenCL.lib"

 

The Error I'm getting is 

 

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86

Copyright (C) Microsoft Corporation.  All rights reserved.

 

hello.cpp

Microsoft (R) Incremental Linker Version 10.00.30319.01

Copyright (C) Microsoft Corporation.  All rights reserved.

 

/out:hello_world.exe

hello.obj

"c:\Program Files (x86)\AMD APP\lib\x86_64\OpenCL.lib"

hello.obj : error LNK2019: unresolved external symbol _clGetPlatformIDs@12 referenced in function "public: static int __cdecl cl:latform::get(class cl::vector

<class cl:latform,10> *)" (?get@Platform@cl@@SAHPAV?$vector@VPlatform@cl@@$09@2@@Z)

hello_world.exe : fatal error LNK1120: 1 unresolved externals

Any help is appreciated


 

 

 

#include <utility> #define __NO_STD_VECTOR // Use cl::vector and cl::string and #define __NO_STD_STRING // not STL versions, more on this later #include <CL/cl.hpp> #include <cstdio> #include <cstdlib> #include <fstream> #include <iostream> #include <string> #include <iterator> const std::string hw("Hello World\n"); inline void checkErr(cl_int err, const char * name) { if (err != CL_SUCCESS) { std::cerr << "ERROR: " << name << " (" << err << ")" << std::endl; exit(EXIT_FAILURE); } } int main(void) { cl_int err; cl::vector< cl::Platform > platformList; cl::Platform::get(&platformList); checkErr(platformList.size()!=0 ? CL_SUCCESS : -1, "cl::Platform::get"); std::cerr << "Platform number is: " << platformList.size() << std::endl; return 0; }

0 Likes
1 Reply
himanshu_gautam
Grandmaster

Please post the system details:

CPU,GPU,AMD APP SDK version,Catalyst Driver version and OS.

Have you tried from visual studio?

0 Likes