I have a dll project in which, when in Release configuration I build the project, I get the following warning:
MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
It's just a warning but I dunno if this should be taken into account.
For what I've found out, they are both multithread libs, normal and debugging versions. My dll uses multithreading and I can debug it, although I use boost:thread for it, so I really dunno if I need this Windows specific libraries for debugging or Release building...
Kind regards, Alex
Well, I did as BuschnicK suggested and using the /VERBOSE:LIB linker flag I found out that I was linking to these libraries in Debug configuration:
boost_filesystem-vc100-mt-gd-1_44.lib: libboost_system-vc100-mt-gd-1_44.lib: libboost_thread-vc100-mt-gd-1_44.lib: libboost_date_time-vc100-mt-gd-1_44.lib:
I had the same in Release config, mostly because I didn't specify then "explicitly". Thus, I changed them to this in Release:
boost_filesystem-vc100-mt-1_44.lib: libboost_system-vc100-mt-1_44.lib: libboost_thread-vc100-mt-1_44.lib: libboost_date_time-vc100-mt-1_44.lib:
That seem to worked but I was still getting the first warning, til I realized I had the _DEBUG preprocessor definition in my Release config too, removed it and it's working sweet now.
Thanks everyone for the help!!
It says what the problem is right in the message if you read carefully: "MSVCRT.lib" vs "msvcrtd.lib"
Notice the added "d" in the second library name. What happens is that you are linking to the visual studio C++ runtime (MSVCRT) statically. One of your libraries is pulling the release version of that lib while another is pulling the debug version (hence the postfix "d"). The linker tells you that both libs define functions with the same name, are in conflict and thus one of them gets dropped automatically.
To fix this, go through the build settings of all your projects/libraries and make sure that they are using the same runtime libraries for all build configurations. Look in project properties
-> C/C++
-> Code Generation
-> Runtime Library
. This should probably read "multi-threaded" for release builds and "multi-threaded debug" for debug builds.
Note that it is generally considered bad practice to link these libraries statically and that you should prefer the dynamically linked dll versions.
It sounds like you could be running a debug library and a release compiled library in the same build.
Go through your project options and select to use the debug versions of any 3rd party libraries you use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With