View Full Version : C++ Binding Link Error in VS 2010

05-19-2011, 11:36 AM
Hi All,

I am having a link error whenever I try to use the C++ bindings in a very basic OpenCL tutorial program using MS Visual Studio 2010. I installed the Nvidia Developers toolkit and added cl.hpp into the include directory from the main OpenCL API registry page.

I have also gone and edited the Properties page as directed by some online instructions. These included modifying:

Additional Include Directories, where I added C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\include

Additional Library Directories, where I added C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v3.2\lib\x64

Additional Dependencies, where I added OpenCL.lib

Without the C++ bindings, everything seems to work great. However, when I do include them, I get a long list of errors similar to this:

1> All outputs are up-to-date.
1>hw.obj : error LNK2019: unresolved external symbol _clGetPlatformInfo@20 referenced in function "public: int __thiscall cl::Platform::getInfo(unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)const " (?getInfo@Platform@cl@@QBEHIPAV?$basic_string@DU?$ char_traits@D@std@@V?$allocator@D@2@@std@@@Z)


1>C:\Users\Jon\Documents\Visual Studio 2010\Projects\HelloWorld\Debug\HelloWorld.exe : fatal error LNK1120: 20 unresolved externals

I have looked through other messages with similar link errors on this site and others, but have not found anything helpful. Any advice would be greatly appreciated.

Thank you in advance!

David Batchelor
05-22-2011, 11:33 AM
I am having the same problem and was hoping that I could get some help from this forum.

05-24-2011, 08:19 AM
Hi David,

I haven't worked through the problem quite yet. I've had some other things come up and have had to switch focus. When I do come up with an answer, I will be sure to post the solution. If you happen to beat me to it, please do the same! :)


David Batchelor
05-24-2011, 02:42 PM
OK Jon,

As the saying goes, "two heads are better then one" provided they are not on top of the same shoulders ;)

06-01-2011, 04:53 AM
Be sure you're linking with win32 libraries and compiling in win32 platform. If you links with shrUtils64.lib but compile in win32, it reports this error.

I hope it helps

06-01-2011, 07:55 PM
This helped tremendously, thank you. I was pointing to the x64 lib folder under the Cuda directory, instead of the Win32. Thank you very much for your help!