CUDA code in static library with Visual Studio

I am exploring the CUDA_ITSOL package developed by Li and Saad for iterative solution of linear systems of equations: This looks very powerful and I’m keen to use it. Unfortunately I work in the Windows world, and, like most people in this area, Li and Saad work in Unix/Linux. They provide instructions for building a static library and a driver for testing the solvers, and it looks very straightforward using Linux, but I am encountering difficulties in trying to build with VS2010.

In the provided makefile, .cpp, .cu, .c and .f files are compiled together and packed into a library. I can compile the single .f file separately, but I encounter a problem when I try to build a library with the other source files. In fact the library build seems to be successful, but in fact none of the .cu files is added. My next idea was to build the .cu files as one library, lib1.lib, and the .cpp and .c files as a second library, lib2.lib. This shows promise, but when I try to link to lib1.lib it generates several link errors like this:

error LNK2001: unresolved external symbol __imp_frexp
error LNK2001: unresolved external symbol __imp_ldexp
error LNK2001: unresolved external symbol __imp_modff

I am keen to know if anybody else has attempted to build the CUDA_ITSOL code with Visual Studio. Any general advice about CUDA with Visual Studio would be much appreciated.


For now I have given up on building a static library, instead I have added all the files to the executable build. It is working, but I’d like to be able to do this in a static library or DLL.

[SOLVED] Find a similar solution below