Porting MatrixMul under Visual Studio 8 Linking errors

Dear All,

I am new to CUDA. I am using Visual Studio 8 to learn how to develop with CUDA. I port the example “lab_sim_mm” from the web site of the book “Programming Massively Parallel Processors” under Visual Studio by creating a new project. Its compilation is OK but there are six error when linking.

Below are the error messages. I would be thanksful if you can help finding the mistakes.

Thanks,
CNgo

matrixMul2_kernel.cu.obj : error LNK2005: “void __cdecl _device_stub__Z15MatrixMulKernel6MatrixS_S(struct Matrix &,struct Matrix &,struct Matrix &)” (?_device_stub__Z15MatrixMulKernel6MatrixS_S@@YAXAAUMatrix@@00@Z) already defined in matrixMul2.cu.obj
1>matrixMul2_kernel.cu.obj : error LNK2005: “void __cdecl MatrixMulKernel(struct Matrix,struct Matrix,struct Matrix)” (?MatrixMulKernel@@YAXUMatrix@@00@Z) already defined in matrixMul2.cu.obj
1>LINK : warning LNK4098: defaultlib ‘MSVCRTD’ conflicts with use of other libs; use /NODEFAULTLIB:library
1>matrixMul2.cu.obj : error LNK2019: unresolved external symbol __imp__cutReadFilef@16 referenced in function “int __cdecl ReadFile(struct Matrix *,char *)” (?ReadFile@@YAHPAUMatrix@@PAD@Z)
1>matrixMul2.cu.obj : error LNK2019: unresolved external symbol __imp__cutWriteFilef@20 referenced in function “void __cdecl WriteFile(struct Matrix,char *)” (?WriteFile@@YAXUMatrix@@PAD@Z)
1>matrixMul2.cu.obj : error LNK2019: unresolved external symbol __imp__cutComparefe@16 referenced in function _main
1>C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\src\matrixMul2\Debug\matrixMul2.exe : fatal error LNK1120: 3 unresolved externals

  • the first two errors indicate you are trying to link two cuda binaries with duplicate definitions (search for MatrixMulKernel in your code and remove the duplicate)
  • the last three errors indicate that you are not linking to cutil32.dll find this dll in you computer and add it to your liker input

hope this helps…