cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Ivoshiee
Journeyman III

AMD OpenCL "Hello World" program does not compile with MSVC++ 2008.

I am trying to get into OpenCL programming, but even the introductory program does not compile.

http://developer.amd.com/gpu/ATIStreamSDK/pages/TutorialOpenCL.aspx

Has a basic "Hello World" implemented in OpenCL, but I fail to compile it.

To set aside that it has a missing "}" in checkErr then more serious issue does come within ATI Stream SDK v2.01 provided cl.hpp file:

C:\lesson1>cl /Fehello_world.exe /I"C:\Program Files\ATI Stream\include" lesson1
.cpp "C:\Program Files\ATI Stream\lib\x86\OpenCL.lib"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

lesson1.cpp
C:\Program Files\ATI Stream\include\CL/cl.hpp(1388) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\ATI Stream\include\CL/cl.hpp(1407) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\ATI Stream\include\CL/cl.hpp(1658) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\ATI Stream\include\CL/cl.hpp(3379) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\ATI Stream\include\CL/cl.hpp(3380) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\ATI Stream\include\CL/cl.hpp(3459) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\ATI Stream\include\CL/cl.hpp(3460) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\ATI Stream\include\CL/cl.hpp(3708) : error C3861: 'alloca': ide
ntifier not found
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C
4530: C++ exception handler used, but unwind semantics are not enabled. Specify
/EHsc
lesson1.cpp(30) : error C2039: 'vector' : is not a member of 'std'
lesson1.cpp(30) : error C2065: 'vector' : undeclared identifier
lesson1.cpp(30) : error C2275: 'cl:latform' : illegal use of this type as an e
xpression
lesson1.cpp(30) : error C2065: 'platformList' : undeclared identifier
lesson1.cpp(31) : error C2065: 'platformList' : undeclared identifier
lesson1.cpp(32) : error C2065: 'platformList' : undeclared identifier
lesson1.cpp(32) : error C2228: left of '.size' must have class/struct/union
        type is ''unknown-type''
lesson1.cpp(33) : error C2065: 'platformList' : undeclared identifier
lesson1.cpp(33) : error C2228: left of '.size' must have class/struct/union
        type is ''unknown-type''
lesson1.cpp(36) : error C2065: 'platformList' : undeclared identifier
lesson1.cpp(36) : error C2228: left of '.getInfo' must have class/struct/union
lesson1.cpp(39) : error C2065: 'platformList' : undeclared identifier

C:\lesson1>

Btw: The Khronos OpenCL API Registry provided files did produce even more errors.

Is it just me or that example is not working for anybody?

What am I doing wrong and/or can that OpenCL example be fixed?

0 Likes
5 Replies
dravisher
Journeyman III

Yeah I had the same experience. My thread about it is here. Basically I had to do:

#include <malloc.h>
#define alloca _alloca
#include <CL/cl.hpp>

Also I used std::vector and strings (i.e. I did not do #define __NO_STD_VECTOR and string). Beyond the missing } in the error checking function I think that was all I had to do to get it working.

0 Likes

Originally posted by: dravisher Yeah I had the same experience. My thread about it is here. Basically I had to do:

 

#include #define alloca _alloca #include

 

Also I used std::vector and strings (i.e. I did not do #define __NO_STD_VECTOR and string). Beyond the missing } in the error checking function I think that was all I had to do to get it working.

 



Thanks a lot!

I wonder why they have a faulty program as their introduction to new technology. Can author be notified about it? I failed to find a suitable e-mail address for that.

0 Likes

Ivoshiee,

Thanks for pointing out. It will be updated soon.

0 Likes

Originally posted by: omkaranathan Ivoshiee,

 

Thanks for pointing out. It will be updated soon.

 

I am glad to help. Now I'll try to find some other intros to play with and hopefully write some my self as well...

0 Likes

I am going through the same issue on openCL, i have contacted to various experties but didn't find the solution, now by the help of your posts i have fixed. thanks guys.

0 Likes