OpenCL undefined reference but lib files in the right place-Collection of common programming errors

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 “openclexample” does contain a lib folder including the reimplemented libOpenCL.a, OpenCL.lib and OVDecode64.lib.

OpenCL.dll in in windows/system32

now when I try to compile using

$ gcc -std=c99 -lOpenCL -o openclexample.exe openclexample.c

all I get is a bunch of undefined reference errors in ALL funktions listet within the OpenCL.def

Ani@ANYONE /d/StuPro/OpenCLtests
$ gcc -std=c99 -lOpenCL -o openclexample.exe openclexample.c 
openclexample.c: In function 'main':
openclexample.c:214:3: warning: implicit declaration of function 'srandom' [-Wim
plicit-function-declaration]
openclexample.c:217:7: warning: implicit declaration of function 'random' [-Wimp
licit-function-declaration]
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x35): undefin
ed reference to `clGetDeviceIDs@24'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x8c): undefin
ed reference to `clCreateContext@24'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0xd9): undefin
ed reference to `clCreateCommandQueue@20'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x127): undefi
ned reference to `clCreateProgramWithSource@20'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x17f): undefi
ned reference to `clBuildProgram@24'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x1be): undefi
ned reference to `clCreateKernel@12'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x22c): undefi
ned reference to `clCreateBuffer@24'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x264): undefi
ned reference to `clCreateBuffer@24'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x29c): undefi
ned reference to `clCreateBuffer@24'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x2f1): undefi
ned reference to `clSetKernelArg@16'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x319): undefi
ned reference to `clSetKernelArg@16'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x346): undefi
ned reference to `clSetKernelArg@16'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x373): undefi
ned reference to `clSetKernelArg@16'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x3e5): undefi
ned reference to `clEnqueueWriteBuffer@36'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x433): undefi
ned reference to `clEnqueueWriteBuffer@36'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x4b2): undefi
ned reference to `clEnqueueNDRangeKernel@36'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x51f): undefi
ned reference to `clEnqueueReadBuffer@36'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x54f): undefi
ned reference to `clFinish@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x55d): undefi
ned reference to `clReleaseMemObject@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x56b): undefi
ned reference to `clReleaseMemObject@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x579): undefi
ned reference to `clReleaseMemObject@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x587): undefi
ned reference to `clReleaseKernel@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x595): undefi
ned reference to `clReleaseProgram@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x5a3): undefi
ned reference to `clReleaseCommandQueue@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x5b1): undefi
ned reference to `clReleaseContext@4'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x72a): undefi
ned reference to `srandom'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x75f): undefi
ned reference to `random'
C:\Users\Ani\AppData\Local\Temp\ccOLx5XT.o:openclexample.c:(.text+0x7a4): undefi
ned reference to `random'
collect2: ld returned 1 exit status

I have read hundreds of threads but didn’t find the solution, some suggested link it with -static, or enter the path where your lib files are… didn’t work either.

I’d be really grateful if anyone else had an idea!