{"id":6130,"date":"2014-04-13T04:33:21","date_gmt":"2014-04-13T04:33:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/opencl-undefined-reference-but-lib-files-in-the-right-place-collection-of-common-programming-errors\/"},"modified":"2014-04-13T04:33:21","modified_gmt":"2014-04-13T04:33:21","slug":"opencl-undefined-reference-but-lib-files-in-the-right-place-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/opencl-undefined-reference-but-lib-files-in-the-right-place-collection-of-common-programming-errors\/","title":{"rendered":"OpenCL undefined reference but lib files in the right place-Collection of common programming errors"},"content":{"rendered":"<p>I have encountered a strange problem while setting up my PC (Win 7 Ultimate 64 CPU AMD\/ GPU AMD) for our current Projekt which requires OpenCL.<\/p>\n<p>I have MSYS so I am working on mingw with gcc. I am desperately trying to compile a simple piece of work called openclexample.<\/p>\n<p>Note: the directory containing &#8220;openclexample&#8221; does contain a lib folder including the reimplemented libOpenCL.a, OpenCL.lib and OVDecode64.lib.<\/p>\n<p>OpenCL.dll in in windows\/system32<\/p>\n<p>now when I try to compile using<\/p>\n<pre><code>$ gcc -std=c99 -lOpenCL -o openclexample.exe openclexample.c\n<\/code><\/pre>\n<p>all I get is a bunch of undefined reference errors in ALL funktions listet within the OpenCL.def<\/p>\n<pre><code>Ani@ANYONE \/d\/StuPro\/OpenCLtests\n$ gcc -std=c99 -lOpenCL -o openclexample.exe openclexample.c \nopenclexample.c: In function 'main':\nopenclexample.c:214:3: warning: implicit declaration of function 'srandom' [-Wim\nplicit-function-declaration]\nopenclexample.c:217:7: warning: implicit declaration of function 'random' [-Wimp\nlicit-function-declaration]\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x35): undefin\ned reference to `clGetDeviceIDs@24'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x8c): undefin\ned reference to `clCreateContext@24'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0xd9): undefin\ned reference to `clCreateCommandQueue@20'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x127): undefi\nned reference to `clCreateProgramWithSource@20'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x17f): undefi\nned reference to `clBuildProgram@24'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x1be): undefi\nned reference to `clCreateKernel@12'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x22c): undefi\nned reference to `clCreateBuffer@24'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x264): undefi\nned reference to `clCreateBuffer@24'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x29c): undefi\nned reference to `clCreateBuffer@24'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x2f1): undefi\nned reference to `clSetKernelArg@16'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x319): undefi\nned reference to `clSetKernelArg@16'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x346): undefi\nned reference to `clSetKernelArg@16'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x373): undefi\nned reference to `clSetKernelArg@16'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x3e5): undefi\nned reference to `clEnqueueWriteBuffer@36'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x433): undefi\nned reference to `clEnqueueWriteBuffer@36'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x4b2): undefi\nned reference to `clEnqueueNDRangeKernel@36'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x51f): undefi\nned reference to `clEnqueueReadBuffer@36'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x54f): undefi\nned reference to `clFinish@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x55d): undefi\nned reference to `clReleaseMemObject@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x56b): undefi\nned reference to `clReleaseMemObject@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x579): undefi\nned reference to `clReleaseMemObject@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x587): undefi\nned reference to `clReleaseKernel@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x595): undefi\nned reference to `clReleaseProgram@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x5a3): undefi\nned reference to `clReleaseCommandQueue@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x5b1): undefi\nned reference to `clReleaseContext@4'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x72a): undefi\nned reference to `srandom'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x75f): undefi\nned reference to `random'\nC:\\Users\\Ani\\AppData\\Local\\Temp\\ccOLx5XT.o:openclexample.c:(.text+0x7a4): undefi\nned reference to `random'\ncollect2: ld returned 1 exit status\n<\/code><\/pre>\n<p>I have read hundreds of threads but didn&#8217;t find the solution, some suggested link it with -static, or enter the path where your lib files are&#8230; didn&#8217;t work either.<\/p>\n<p>I&#8217;d be really grateful if anyone else had an idea!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have encountered a strange problem while setting up my PC (Win 7 Ultimate 64 CPU AMD\/ GPU AMD) for our current Projekt which requires OpenCL. I have MSYS so I am working on mingw with gcc. I am desperately trying to compile a simple piece of work called openclexample. Note: the directory containing &#8220;openclexample&#8221; [&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-6130","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6130","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=6130"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6130\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}