2

I get the following error while trying to build a CUDA/C++ code in Visual Studio 2012. I'm using CUDA v5.0

1> Generating Code... 1>LINK : warning LNK4044: unrecognized option '/MLd'; ignored 1>cublas_device.lib(kepler_sm35_gemm_wrapper.obj) : error LNK2019: unresolved external symbol __cudaRegisterLinkedBinary_59_tmpxft_00001040_00000000_8_kepler_sm35_gemm_wrapper_cpp1_ii_9402ff4f referenced in function "void __cdecl __sti____cudaRegisterAll_59_tmpxft_00001040_00000000_8_kepler_sm35_gemm_wrapper_cpp1_ii_9402ff4f(void)" (?__sti____cudaRegisterAll_59_tmpxft_00001040_00000000_8_kepler_sm35_gemm_wrapper_cpp1_ii_9402ff4f@@YAXXZ) 

Anybody has any idea of where the problem might be? I've tried googling around, but haven't found a solution for this as yet.

Thanks a lot!

5
  • A similar post is stackoverflow.com/questions/2061715, have you tried this solution? Commented Feb 16, 2013 at 7:11
  • Hi Jermaine, Yes I have the correct CUDA library path added in "Configuration Properties->Linker->Input" and I still get this error. In fact, cublas_device.lib (the file that has an unresolved external symbol) is itself part of the CUDA library - so, my linker is being able to find those library files correctly. I think this library file references something that is not being found by the linker. Also, this happens only when my Visual Studio Configuration Platform is "Debug". When it is "Release", the executable builds correctly. Commented Feb 16, 2013 at 7:45
  • Ok, just try these two things: first add cudart.lib if you hadn't already, but probably you did. second: try enabling separate compile in your application properties -> linker options. See if that helps. (EDIT: also try removing device-link.obj as is described here Commented Feb 16, 2013 at 15:29
  • I don't see any option to enable separate compile in properties->linker. Can you please be a little more specific about what option you want me to select? Also, which section in the linker options are you talking about? Commented Feb 16, 2013 at 19:06
  • I believe this issue is due to some incorrect combination of -c/-dc/-rdc switches getting passed to individual modules and/or the final link step. It would be helpful if you could paste into the original question the complete command lines issued to nvcc for each module and the final link step to build your application. Also, by any chance is this a project that you migrated forward from cuda 4.2 (or something earlier) to cuda 5.0? Commented Feb 22, 2013 at 4:29

6 Answers 6

2

This article shows information about what the /MLd linker option does. It essentially has to do with multithreaded libs being loaded and the configuration of your project.

Sign up to request clarification or add additional context in comments.

Comments

2
+50

Is your (Debug) project set up to link with the microsoft linker or nvcc? (The error messages appear to be coming from the microsoft linker.) You may want to look at this question

Device code and device libraries (that you are linking against) need to be linked with nvcc.

Comments

1

You need to link against the debug version of the CUDA library. You try to compile in Debug mode, but then you link against a library which seems not to have been built in debug mode. Thus it gets all messed up.

So you should either get the .lib file for the debug version, or build it yourself if you have the source code. Then you link your debug build with the debug .lib and same for release.

Also, it may help that you use the same version of the compiler to build all libs, otherwise you may run into name mangling issues (which could be also a potential cause for your problem). It happened to me after switching to a newer VS version: I had to recompile all the .lib I was linking against.

Comments

0

It looks like some sort of using a external (extern) variable that isn't defined. The code is required for further information

Comments

0

I was able to fix it! I was linking to cublas_device.lib which was referring to an unresolved external symbol. However, this lib file wasn't required by my project, so just removing it from the linked files worked! However, in Release mode this error wasn't happening - maybe because this part of the code in cublas_device.lib was in the debug section.

In any case, since it is not required by my project, removing it solves the problem.

Thanks a lot for all your replies!

Comments

0

I encountered the same issue, Changing the Configuration Type from "Dynamic library (dll)" to "Static library (lib)" worked for me.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.