Gamaru / opencl-book-samples

Automatically exported from code.google.com/p/opencl-book-samples
0 stars 0 forks source link

LNK2019 errors when building Hello World #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Is this errata for the book or an issue with the source code?

Source Code.
I am having a problem with the source code. Here is my environment.

Windows 7
Visual Studio 2010
AMD implementation

Please provide any additional information below.

I just downloaded the code a few hours ago. I am trying to compile and run the 
"Hello World" program in VS2010. The compilation works fine but I get a bunch 
of errors with the linker.

error LNK2019: unresolved external symbol _clCreateContextFromType@24 ...
error LNK2019: unresolved external symbol _clGetPlatformIDs@12  ...
error LNK2019: unresolved external symbol _clCreateCommandQueue@20  ...
error LNK2019: unresolved external symbol _clGetContextInfo@20  ...
error LNK2019: unresolved external symbol _clReleaseProgram@4  ...
error LNK2019: unresolved external symbol _clGetProgramBuildInfo@24  ...
error LNK2019: unresolved external symbol _clBuildProgram@24  ...
error LNK2019: unresolved external symbol _clCreateProgramWithSource@20  ...
error LNK2019: unresolved external symbol _clCreateBuffer@24  ...
error LNK2019: unresolved external symbol _clReleaseContext@4  ...
error LNK2019: unresolved external symbol _clReleaseKernel@4  ...
error LNK2019: unresolved external symbol _clReleaseCommandQueue@4  ...
error LNK2019: unresolved external symbol _clReleaseMemObject@4  ...
error LNK2019: unresolved external symbol _clEnqueueReadBuffer@36  ...
error LNK2019: unresolved external symbol _clEnqueueNDRangeKernel@36  ...
error LNK2019: unresolved external symbol _clSetKernelArg@16  ...
error LNK2019: unresolved external symbol _clCreateKernel@12 ...

More detailed errors are in the attached file.

Any help is greatly appreciated.

Thanks

Chris

Original issue reported on code.google.com by cnatha...@gmail.com on 4 Aug 2011 at 9:00

Attachments:

GoogleCodeExporter commented 8 years ago
Can you please also send us your CMakeCache.txt?  My guess would be that for 
some reason the AMD OpenCL library location was not properly detected by 
FindOpenCL.cmake. Please look in the cmake-gui and see if it determined the 
right path for you OpenCL library.

Original comment by dginsb...@upsamplesoftware.com on 4 Aug 2011 at 9:11

GoogleCodeExporter commented 8 years ago
File enclosed. Thank you for your help.

- Chris

Original comment by cnatha...@gmail.com on 4 Aug 2011 at 9:54

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry, I meant for you to send the root level CMakeCache.txt.  In any case, 
please look in cmake-gui at the values for OPENCL_INCLUDE_DIRS and 
OPENCL_LIBRARIES (switch to "Advanced" mode if you did not see the options). It 
looks to me like those are not set.  They should have values something like the 
following:

//Path to a file.
OPENCL_INCLUDE_DIRS:PATH=C:/Program Files (x86)/ATI Stream/include

//Path to a library.
OPENCL_LIBRARIES:FILEPATH=C:/Program Files (x86)/ATI Stream/lib/x86/OpenCL.lib

Since it is compiling but not linking, chances are that your include directory 
is set but the library path is not.  If you can confirm this is the problem, 
please post the value of your ATISTREAMSDKROOT environment variable and what 
the correct location of your OpenCL.lib is.  I have not tried the AMD SDK in a 
while, so maybe they changed something which is causing FindOpenCL.cmake not to 
find the library.

Original comment by dginsb...@upsamplesoftware.com on 4 Aug 2011 at 10:21

GoogleCodeExporter commented 8 years ago
One comment is that it is now AMD APP SDK and not ATI Stream, so you should 
check you install path is correct.

Original comment by benedict...@gmail.com on 4 Aug 2011 at 10:35

GoogleCodeExporter commented 8 years ago
I am able to compile and link by making the changes manually. 

I have attached a file that shows the results when I tried to set it through 
the cmake-gui.

Thanks for your help. 

Chris

Original comment by cnatha...@gmail.com on 5 Aug 2011 at 12:51

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the detailed error report.  Unfortunately, I don't at the moment 
have a Windows-based system with AMD GPU to test this on.  Ben, are you able to 
reproduce this problem with the latest AMD APP SDK?  I'm wondering if the issue 
is with FindOpenCL.cmake depending on an environment variable that is no longer 
set by the SDK.

Original comment by dan.r.gi...@gmail.com on 6 Aug 2011 at 12:39

GoogleCodeExporter commented 8 years ago

Original comment by dginsb...@upsamplesoftware.com on 6 Aug 2011 at 12:55

GoogleCodeExporter commented 8 years ago

Original comment by dginsb...@upsamplesoftware.com on 6 Aug 2011 at 12:55