cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

samohtnnud
Journeyman III

Trouble with Hello World

I'm trying to learn OpenCL and I've tried doing the hello world OpenCL tutorial using SDK 2.6 in windows 7 64 bit and visual studios 10, but I've been having no luck getting it to compile. I keep getting several errors such as:

1>c:\program files (x86)\amd app\include\cl\cl.hpp(1606): error C2039: 'clUnloadCompiler' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(1606): error C3861: 'clUnloadCompiler': identifier not found

along with the same error for several other functions. I've attached my main cpp file although I'm fairly certain I copied the tutorial verbatim and I've already included $(AMDAPPSDKROOT)\include, $(AMDAPPSDKROOT)\lib\x86, and OpenCL.lib in there respective places. I am completely lost as to how to proceed from here and would appreciate any advice or feedback.

0 Likes
5 Replies
arashaneh
Journeyman III

I have same problem with SDK 2.6 with OpenCL 1.2.

What should we do ?!

These are Outputs......

1>------ Build started: Project: HelloCL, Configuration: Debug Win32 ------

1>Build started 3/28/2012 10:21:12 AM.

1>InitializeBuildStatus:

1>  Touching "Debug\Win32\HelloCL.unsuccessfulbuild".

1>ClCompile:

1>  HelloCL.cpp

1>c:\program files (x86)\amd app\include\cl\cl.hpp(1606): error C2039: 'clUnloadCompiler' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(1606): error C3861: 'clUnloadCompiler': identifier not found

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2365): error C2039: 'clCreateImage2D' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2365): error C3861: 'clCreateImage2D': identifier not found

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2410): error C2039: 'clCreateFromGLTexture2D' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2410): error C3861: 'clCreateFromGLTexture2D': identifier not found

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2464): error C2039: 'clCreateImage3D' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2464): error C3861: 'clCreateImage3D': identifier not found

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2510): error C2039: 'clCreateFromGLTexture3D' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(2510): error C3861: 'clCreateFromGLTexture3D': identifier not found

1>c:\program files (x86)\amd app\include\cl\cl.hpp(3745): error C2039: 'clEnqueueMarker' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(3745): error C3861: 'clEnqueueMarker': identifier not found

1>c:\program files (x86)\amd app\include\cl\cl.hpp(3752): error C2039: 'clEnqueueWaitForEvents' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(3752): error C3861: 'clEnqueueWaitForEvents': identifier not found

1>c:\program files (x86)\amd app\include\cl\cl.hpp(3867): error C2039: 'clEnqueueBarrier' : is not a member of '`global namespace''

1>c:\program files (x86)\amd app\include\cl\cl.hpp(3867): error C3861: 'clEnqueueBarrier': identifier not found

1>g:\works\amd app\samples\opencl\cpp_cl\app\hellocl\hellocl.cpp(191): error C2440: 'initializing' : cannot convert from 'cl::detail::param_traits<cl::detail::cl_program_build_info,4483>::param_type' to 'cl::string'

1>          No constructor could take the source type, or constructor overload resolution was ambiguous

1>

1>Build FAILED.

0 Likes

Hmm. I wasn't aware that 2.6 had 1.2 support.

Add:

#define CL_USE_DEPRECATED_OPENCL_1_1_APIS

before you include cl.hpp (and more importantly before you or it includes cl.h) should fix it. We're working on the update of cl.hpp for 1.2 support at the moment.

0 Likes

Did you mean like  this :

#define CL_USE_DEPRECATED_OPENCL_1_1_APIS

 

#include <CL/cl.hpp>

#include <cstdio>

#include <cstdlib>

#include <iostream>

#include <SDKFile.hpp>

#include <SDKCommon.hpp>

#include <SDKApplication.hpp>

 

#define __NO_STD_STRING

I did that just right now, but it didn't work for me.

There is no reference to CL_USE_DEPRECATED_OPENCL_1_1_APIS in entire project, so defining it would not have any effect on the problem.

0 Likes

Those look like the functions deprecated from 1.1 to 1.2, and in the 1.2 headers they are wrapped with that define. Search the cl.h that's being included and check that I typed it right and that it's in there. If you search for clCreateImage2D you should see it wrapped that way, and clCreateImage should be present in the header as the newer replacement.

__NO_STD_STRING should be defined before cl.hpp too if you want that to have any effect.

0 Likes

Thanks a lot, the problem was solved just by changing __NO_STD_STRING line, after adding #define CL_USE_DEPRECATED_OPENCL_1_1_APIS.

So, now my HelloCL starts like this, and it is working!

#define CL_USE_DEPRECATED_OPENCL_1_1_APIS

#define __NO_STD_STRING

#include <CL/cl.hpp>

#include <cstdio>

#include <cstdlib>

#include <iostream>

#include <SDKFile.hpp>

#include <SDKCommon.hpp>

#include <SDKApplication.hpp>

0 Likes