Moving from CUDA 1.0 to 2.0b2 Hit a small snag...

Hello guys and gals.

Been using cmake to provide a cross-platform release of my particle accelerator modelling code with good success so far. Got a release version under Linux and CUDA 2.0 ready to go, and a Windows version under CUDA 1.0.

What is left to do is a Windows XP CUDA 2.0 beta-2 version. Unfortunately, I get an error…

1>------ Build started: Project: coreGPU, Configuration: Debug Win32 ------


1>coreGPU.cu_coreGPU_generated.obj : error LNK2019: unresolved external symbol __imp__cutCheckCmdLineFlag@12 referenced in function _theCoreGPU

1>coreGPU.cu_coreGPU_generated.obj : error LNK2019: unresolved external symbol __imp__cutGetCmdLineArgumenti@16 referenced in function _theCoreGPU

1>C:\Documents and Settings\mick\Desktop\GPMADworksonLINUX\GPMAD\build\CUDA\src\Debug\coreGPU.dll : fatal error LNK1120: 2 unresolved externals

1>Build log was saved at "file://c:\Documents and Settings\mick\Desktop\GPMADworksonLINUX\GPMAD\build\CUDA\src\coreGPU.dir\Debug\BuildLog.htm"

1>coreGPU - 3 error(s), 0 warning(s)

2>------ Build started: Project: GPMAD, Configuration: Debug Win32 ------


2>LINK : fatal error LNK1104: cannot open file '..\CUDA\src\Debug\coreGPU.lib'

2>Build log was saved at "file://c:\Documents and Settings\mick\Desktop\GPMADworksonLINUX\GPMAD\build\src\GPMAD.dir\Debug\BuildLog.htm"

2>GPMAD - 1 error(s), 0 warning(s)

3>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------

3>Project not selected to build for this solution configuration 

========== Build: 0 succeeded, 2 failed, 3 up-to-date, 1 skipped ==========

What common causes are there of a LNK2019 error?



Are you sure you’re using new headers and linking to new .lib files?

I’m guessing you installed CUDA 2.0b2 directly over 1.0 in the same directory, so you still have a 1.0 cutil; try recompiling it and see if that fixes it.

tmurray. No, I uninstalled CUDA 1.0 as per the release notes, restarted, and then installed CUDA 2.0 toolkit and SDK.

AndreiB, the CMake FindCUDA.cmake script from Abe Stephens handles location of the relevant libraries and headers. From what I can see though, all the newer libraries are used. I shall check the command lines of the build log, just to be sure.

Many thanks,


Sorted now. Basically, I had hard-coded ‘cutil’ as a linking library in the CMake CMakelists.txt. By linking to the correct library, as found by the FindCUDA.cmake script (cutil32), everything is working nicely.

Rather than starting a new thread, just thought I should continue here…

When running under CUDA 2.0, each time the kernel is called I get the message displayed…

Error when parsing command line arguments

Error when parsing command line arguments

Using device 0: GeForce 8800 Ultra

Now the output files are as expected, and so it has worked nicely, but what causes this error?

A potential candidate is that CUT_DEVICE_INIT() now (under 2.0)requires two arguments, whereas this was not needed under 1.0. To avoid having to add ('int argc, char** argv) everywhere, I just created dummy variables set to null, and passed them to CUT_DEVICE_INIT(). Is that possibly a mistake?



I could imagine to properly fake it out, you would need to set argc = 1, and char **argv = {“dummyname”}. (Disclaimer: I have not tried this…)

Cheers seibert, I have actually temporarily eliminated CUT_DEVICE_INIT() and the error goes away, so it was definitely here that the problem was. Better put it back in to be safe though.

CUT_DEVICE_INIT is just a handy way to call cudaSetDevice(). If you do not find it handy, replace it with your own function call to choose a GPU and call cudaSetDevice().