Linking issue with (Intel SDK) OpenCL and Code::Blocks-Collection of common programming errors
I was trying to get my problem solved for hours, but I did not find any usefull hints. Hopefully you guys can help me out:
Some usefull data: OS: Windows 8 Basic 64bit Library: Intel OpenCL SDK Compiler: MinGW(-gcc) (latest version) IDE: Code::Blocks (latest version)
Minimal not working Code:
#include
#include
int main(void)
{
cl_uint available;
cl_platform_id* platforms = (cl_platform_id*)malloc(sizeof(cl_platform_id));
cl_int result = clGetPlatformIDs(1, platforms, &available);
free(platforms);
if(result == CL_SUCCESS)
return 0;
return -1;
}
Code::Blocks Global Compiler Settings: Linker Settings: Added path to Intel’s OpenCL.lib ([…]\Intel\OpenCL SDK\3.0\lib\x64\OpenCL.lib) (tried -lOpenCL as Other Options as well) Search-Directories for Compiler: Path to Intels OpenCL-SDK include directory ([…]\Intel\OpenCL SDK\3.0\include) Search-Directories for Linker: Path to Intels OpenCL-Lib directory ([…]\Intel\OpenCL SDK\3.0\lib\x64)
Build-Log:
mingw32-g++.exe -L"[...]\Intel\OpenCL SDK\3.0\lib\x64" -o bin\Release\openCLTest.exe obj\Release\main.o -s "[...]\Intel\OpenCL SDK\3.0\lib\x64\OpenCL.lib"
obj\Release\main.o:main.c:(.text.startup+0x39): undefined reference to `clGetPlatformIDs@12'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)
I do not know why he does not link properly. The […] in the text is modified by me to shorten the path, normally it would be “C:\Program Files (x86)…”.
Hopefully you guys can help me! It is really frustrating! 🙁
Do you need more information?
EDIT: Okay… one additional hour and I solved my own problem. Hope this hint can help some other ppl: I had to link additionally against the x86-library (seems that some functions are not implemented in X64).
Good to know -.-”’