Hardware specs :
Core: Intel Core i7 2600
GPU: Nvidia Geforce Gtx-580
IDE 1: QT 4.8
IDE 2: Visual Studio 2013
OS: Windows 7
Compiler for QT: mingw32-g+.exe
Compiler for VS: cl.exe
SDK: Intel OpenCL Code builder 2015, v 184.108.40.206
Goal: Have a 32bit build application in QT4.8 using OpenCL and mingw32-g++ compiler.
Building a simple hello world program that reference any opencl methods, I get an undefined reference.
undefined reference to clGetPlatformIDs@12
undefined reference to _clCreateBuffer@24 referenced in function _main
What I have done:
- reference compiler to includes of intel includes =>C:\Intel\INDE\code_builder_220.127.116.11\include
- reference linker to intel librarie OpenCL.lib=> C:\Intel\INDE\code_builder_18.104.22.168\lib\x86
In visual studio I get to compile properly. but building (compile + link) I get the error. And this linking only works well if I build for a x64 platform, and reference the VS IDE to the x64 libraries. C:\Intel\INDE\code_builder_22.214.171.124\lib\x64 instead
1. What am I doing wrong? How to get it to work?
2. Does the OpenCL libraries really support x86 platforms? I dumpbin the libraries for both platform, and the symbols name were differnent. in x64 they had for example clGetPlatformIDs and in x86 library _clGetPlatformIDs@12.
3. My platform is openCL 1.2, Should I be put the visual studio include path to a opencl 1.2 header files? instead of the ones came with the sdk? I assume they are for opencl 2.1
If you mix the obsolete stdcall API of 15 years ago (as shown in your undefined references) with the current cdecl you are bound to fail.
Mixing 32-bit and X64/intel64 builds won't work, regardless of stdcall settings.
As you saw, Microsoft and Intel support were transitioned to cdecl when X64 was invented.
Mixing mingw and VS compatible compilation seems doubtful, as run-time library conflicts are likely.
I don't know about interoperability of opencl and c++, but it seems at best it would be restricted to current x64/Intel64 mode. It's strange that it's so hard to find information on the 32 vs. 64-bitness of the OpenCL.