3 Replies Latest reply on Feb 26, 2010 4:58 AM by dravisher

    [SOLVED] Trying to compile hello world program

    dravisher
      Lots of error messages that I don't understand

      Hi. I'm trying to compile the hello world program presented here:

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

      I've copied everything up to and including the 5 first lines of the main function, and added return 0 at the end. The code is attached.

      I'm using Visual Studio 2008 Professional SP1,  on Windows 7 x64 (with 64-bit version of Stream SDK). The errors generated are:

      1>.\OCLTest.cpp(25) : error C2039: 'vector' : is not a member of 'std'
      1>.\OCLTest.cpp(25) : error C2065: 'vector' : undeclared identifier
      1>.\OCLTest.cpp(25) : error C2653: 'cl' : is not a class or namespace name
      1>.\OCLTest.cpp(25) : error C2065: 'Platform' : undeclared identifier
      1>.\OCLTest.cpp(25) : error C2065: 'platformList' : undeclared identifier
      1>.\OCLTest.cpp(26) : error C2653: 'cl' : is not a class or namespace name
      1>.\OCLTest.cpp(26) : error C2065: 'platformList' : undeclared identifier
      1>.\OCLTest.cpp(26) : error C3861: 'get': identifier not found
      1>.\OCLTest.cpp(27) : error C2065: 'platformList' : undeclared identifier
      1>.\OCLTest.cpp(27) : error C2228: left of '.size' must have class/struct/union
      1> type is ''unknown-type''
      1>.\OCLTest.cpp(28) : error C2065: 'platformList' : undeclared identifier
      1>.\OCLTest.cpp(28) : error C2228: left of '.size' must have class/struct/union

      It does seem like I've added the Stream SDK include directory correctly (since there are no errors pertaining to the include statements), and I've also tried to add opencl.lib as a dependency, but to no avail. Please note that I'm certainly a newbie at this. Though I have programmed several C++ applications in numerical physics using MPI, that is the extent of my programming knowledge, so I may have missed something trivial here.

       

      If anyone would be bothered to point me in the right direction that would be great

       

      Edit: forgot to specify, this is with v2.01 of the SDK.

      #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.h> #include <cstdio> #include <cstdlib> #include <fstream> #include <iostream> #include <string> #include <iterator> 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; std::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; }

        • Trying to compile hello world program
          dravisher

          Changed #include <CL/cl.h> to <CL/cl.hpp> to (don't know how I that error got in there), and now my error messages are:

          1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(1388) : error C3861: 'alloca': identifier not found 1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(1407) : error C3861: 'alloca': identifier not found 1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(1658) : error C3861: 'alloca': identifier not found 1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(3379) : error C3861: 'alloca': identifier not found 1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(3380) : error C3861: 'alloca': identifier not found 1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(3459) : error C3861: 'alloca': identifier not found 1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(3460) : error C3861: 'alloca': identifier not found 1>C:\Program Files (x86)\ATI Stream\include\CL/cl.hpp(3708) : error C3861: 'alloca': identifier not found 1>.\OCLTest.cpp(25) : error C2039: 'vector' : is not a member of 'std' 1>.\OCLTest.cpp(25) : error C2065: 'vector' : undeclared identifier 1>.\OCLTest.cpp(25) : error C2275: 'cl::Platform' : illegal use of this type as an expression 1>.\OCLTest.cpp(25) : error C2065: 'platformList' : undeclared identifier 1>.\OCLTest.cpp(26) : error C2065: 'platformList' : undeclared identifier 1>.\OCLTest.cpp(27) : error C2065: 'platformList' : undeclared identifier 1>.\OCLTest.cpp(27) : error C2228: left of '.size' must have class/struct/union 1> type is ''unknown-type'' 1>.\OCLTest.cpp(28) : error C2065: 'platformList' : undeclared identifier 1>.\OCLTest.cpp(28) : error C2228: left of '.size' must have class/struct/union 1> type is ''unknown-type''