I can not use tdm-gcc to compile opencl code in codeblocks, what's wrong?

I can not use tdm-gcc to compile opencl code in codeblocks, what's wrong?

Hi, all,

      I met a problem when I use tdm-gcc to compile my code in codeblocks, it doesn't work, but the code runs correctly when I use the default complier MinGW-gcc. I don't know why and this problem bugs me three days. The example is simple:

#include <CL/cl.h>
using namespace std;

int main(int argc, char* argv[])

{

    cl_uint numPlatforms;//the NO. of platforms
    cl_int  status = clGetPlatformIDs(0, NULL, &numPlatforms);
    return 0;
}

 when I use the default comipler it works without error. but when I change to tdm-gcc things go wrong as:

 

-------------- Build: Debug in openCL_example (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -fexceptions -g -IC:\Intel\OpenCL\sdk\lib\x86 -IC:\Intel\OpenCL\sdk\include -c "D:\Program Files\codeblocks\projects\openCL_example\HelloWorld.cpp" -o obj\Debug\HelloWorld.o

g++.exe -Wall -fexceptions -g -IC:\Intel\OpenCL\sdk\lib\x86 -IC:\Intel\OpenCL\sdk\include -c "D:\Program Files\codeblocks\projects\openCL_example\tool.cpp" -o obj\Debug\tool.o

g++.exe  -o bin\Debug\openCL_example.exe obj\Debug\HelloWorld.o obj\Debug\tool.o   C:\Intel\OpenCL\sdk\lib\x86\OpenCL.lib
obj\Debug\HelloWorld.o

: In function `main':
D:/Program Files/codeblocks/projects/openCL_example/HelloWorld.cpp:76: undefined reference to `clGetPlatformIDs'
obj\Debug\tool.o: In function `getPlatform(_cl_platform_id*&)':

.....

please help !! thanks a lot .

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.