Pregunta

Still suffering through a major compile as detailed over here, but I have a specific side question about the use of /NODEFAULTLIB.

I've been trying to use this /NODEFAULTLIB:LIBCMTD switch in order to resolve a linker problem where one of the projects in the solution is using /MTd (LIBCMTD.LIB) instead of /MDd MSVCR90D.DLL.

Unfortunately, as you can probably guess by the title of this post, I don't seem to be using this correctly. Upon building the solution, I see this warning in three places:

1>cl : Command line warning D9002 : ignoring unknown option '/NODEFAULTLIB:LIBCMTD'

I'm running Visual Studio 2008 Standard SP1 on Windows XP Professional SP3. I'm adding this switch by right-clicking on the troublesome project, selecting properties, expanding the "Configuration Properties", expanding the C/C++ list, selecting "Command Line", and entering /NODEFAULTLIB:LIBCMTD in the "Additional options" field.

I was reading elsewhere on the web that this should be a linker setting, and not a C/C++ setting, so I've also tried entering it under Configuration Properties->Build Events->Pre-Link Event->Command Line, though this gave me warnings of its own without yielding any different results from the compile:

1>The filename, directory name, or volume label syntax is incorrect. 1>Project : error PRJ0019: A tool returned an error code from "Performing Pre-Link Event..."

So folks... what about the /NODEFAULTLIB switch am I not understanding here? How can I get VS2008 to recognize the command and stop ignoring it?

Thanks, -Alex

¿Fue útil?

Solución

In project properties you will find: Configuration Properties -> Linker -> Input ->

 'Ignore All Default Libraries'
 'Ignore Specific Default Libraries' <-- this is I suppose of interest for you

you can try putting libc;libcmtd;libcd in there but I never tried it, compiling all libs under the same configuration is the proper way

Otros consejos

This option is documented here. On the face of it, it appears you're using it correctly now that you're using it on the linker page rather than the C++ page, but I suspect that what may be missing is that you need to include .lib in the filename, eg:

/NODEFAULTLIB:LIBCMTD.LIB

I think that if you remove this option and look at the linker errors you get then it will tell you the exact syntax you need. A better solution though is to look at all the individual libraries and dlls in this project and find which ones are using the other runtime library. Better to fix the source of the problem than workaround it later on.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top