{"id":6138,"date":"2014-04-13T04:34:03","date_gmt":"2014-04-13T04:34:03","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/linking-issue-with-intel-sdk-opencl-and-codeblocks-collection-of-common-programming-errors\/"},"modified":"2014-04-13T04:34:03","modified_gmt":"2014-04-13T04:34:03","slug":"linking-issue-with-intel-sdk-opencl-and-codeblocks-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/linking-issue-with-intel-sdk-opencl-and-codeblocks-collection-of-common-programming-errors\/","title":{"rendered":"Linking issue with (Intel SDK) OpenCL and Code::Blocks-Collection of common programming errors"},"content":{"rendered":"<p>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:<\/p>\n<p>Some usefull data: OS: Windows 8 Basic 64bit Library: Intel OpenCL SDK Compiler: MinGW(-gcc) (latest version) IDE: Code::Blocks (latest version)<\/p>\n<p>Minimal not working Code:<\/p>\n<pre><code>#include \n#include \n\nint main(void)\n{\n  cl_uint available;\n  cl_platform_id* platforms = (cl_platform_id*)malloc(sizeof(cl_platform_id));\n  cl_int result = clGetPlatformIDs(1, platforms, &amp;available);\n  free(platforms);\n  if(result == CL_SUCCESS)      \n    return 0;      \n  return -1;\n}\n<\/code><\/pre>\n<p>Code::Blocks Global Compiler Settings: Linker Settings: Added path to Intel&#8217;s OpenCL.lib ([&#8230;]\\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 ([&#8230;]\\Intel\\OpenCL SDK\\3.0\\include) Search-Directories for Linker: Path to Intels OpenCL-Lib directory ([&#8230;]\\Intel\\OpenCL SDK\\3.0\\lib\\x64)<\/p>\n<p>Build-Log:<\/p>\n<pre><code>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\" \nobj\\Release\\main.o:main.c:(.text.startup+0x39): undefined reference to `clGetPlatformIDs@12'\ncollect2.exe: error: ld returned 1 exit status\nProcess terminated with status 1 (0 minutes, 0 seconds)\n1 errors, 0 warnings (0 minutes, 0 seconds)\n<\/code><\/pre>\n<p>I do not know why he does not link properly. The [&#8230;] in the text is modified by me to shorten the path, normally it would be &#8220;C:\\Program Files (x86)&#8230;&#8221;.<\/p>\n<p>Hopefully you guys can help me! It is really frustrating! \ud83d\ude41<br \/>\nDo you need more information?<\/p>\n<p>EDIT: Okay&#8230; 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).<\/p>\n<p>Good to know -.-&#8221;&#8217;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6138","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6138"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6138\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}