OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

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

: 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 .

0 Kudos
0 Replies