library is linked but reference is undefined

when you are linking, the order of your libraries and source files makes a difference. for example for your case,

g++ -I/usr/local/cuda/include -L/usr/lib/nvidia-current -lOpenCL opencl.cpp

functions defined in the OpenCL library might not be loaded, since there nothing before them asking for a look-up. however if you use,

g++ opencl.cpp -I/usr/local/cuda/include -L/usr/lib/nvidia-current -lOpenCL  

then any requests for functions will be found in the OpenCL library and they will be loaded.

Leave a Comment

tech