cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rolandman99
Journeyman III

Help OpenCL Hello World in VS2008 Express

Hi,

 

I tried this code example with ATI Stream SDK 2.01 and VS2008 Express. I read other thread in this forum and follow their example

 

#include
#include
#define alloca _alloca
#define __NO_STD_VECTOR // Use cl::vector and cl::string and
#define __NO_STD_STRING  // not STL versions, more on this later
#include

#include
#include
#include
#include
#include
#include

const cl::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;
}

 

I got the error:

1>------ Build started: Project: TestOpenCL, Configuration: Debug Win32 ------
1>Linking...
1>main.obj : error LNK2019: unresolved external symbol _clGetPlatformIDs@12 referenced in function "public: static int __cdecl cl::Platform::get(class cl::vector *)" (?get@Platform@cl@@SAHPAV?$vector@VPlatform@cl@@$09@2@@Z)
1>C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\TestOpenCL\Debug\TestOpenCL.exe : fatal error LNK1120: 1 unresolved externals


...


1>TestOpenCL - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Anyone know what is the cause of this error?  One more, anyone can give a hint (or maybe more detail steps) how to compile the OpenCL samples come with the SDK?

I really got frustrated setting the VS 2008 to build the example. Do I need to set the lib file, etc (for example in D3DX, we set the d3d10.lib, d3dx10.lib, etc). Can someone give a detail enough step to do this?

Thank you very much for help.

 

 

0 Likes
8 Replies
afo
Adept I

Hi,

You need at least VS2008 Professional to work with OpenCL, see system requirements in SDK page.

hope this helps,

Alfonso

0 Likes

So it should use VS2008 Professional? Unfortunately, I'm a student and have no access to paid software such as VS2008 Professional version

Any other way to do this?

Thank you

 

 

 

 

0 Likes

In windows, no...

Your other option is to switch to linux, but it could have a high learning curve, depending on your background.

best regards,

Alfonso

0 Likes

it should work with Express Edition too.

or just install ubuntu, install my package for ubutnu and you can start writing your programs. you can try some IDE like Code::Blocks, Netbeans, KDevelop or Eclipse. there are plenty of them.

0 Likes

Originally posted by: rolandman99 So it should use VS2008 Professional? Unfortunately, I'm a student and have no access to paid software such as VS2008 Professional version

Any other way to do this?

Thank you



Check out DreamSpark: https://www.dreamspark.com/Default.aspx.

0 Likes

rolandman99,

nou is correct.You can use VS express edition for openCL.

As a matter of fact it is possible even without VS if you know

how to use make files.

Kindly post the following:

OS,Driver version,GPU(s) installed.

and are you able to run the samples provided in sdk?

I recommend using SDK 2.2 and driver 10.8 or 10.9.

Waiting for reply.

0 Likes

Hi all,

Thank you very much for help. Finally, it can work. I can start to learn OpenCL (although I don't really like to develop on Windows, I have another PC with Fedora 9 and CentOS 5.4, but don't know if I can use the ATI Stream SDK with those OS)

PC spec:

AMD Athlon64 X2 Dual Core 4400+. Have no GPU supported OpenCL (maybe I will buy one). The GPU is onboard ATI Radeon X1250 256 MB. For now, I think I can only run using the CPU.

By the way, I choose the SDK 2.01 because it uses OpenCL 1.0 (I have plan to try the code developed on Cell BE because I have a PS3). The Cell BE only support OpenCL 1.0 this time.

 

 

 

 

 

0 Likes

you can download the SDK for linux to run openCL on linux environments.

Happy programming

0 Likes