Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug application when third-party library provides no debug build?

I have an application I'm working on that uses two third party libraries, each with pre-compiled libs and dlls, one of which provides necessary .lib files for both debug and release builds (A[d].lib) and the other which provides only .lib files for release builds (B.lib).

Compiling in Release mode (using MSVC9) works fine, however attempting to compile in debug mode fails because third party A requires LIBCMTD.lib (or MSVCRTD.lib) while third party B requires LIBCMT.lib (or MSVCRT.lib).

Can I work around this or am I stuck debugging in release mode?

like image 390
Geoff Avatar asked Sep 02 '25 02:09

Geoff


2 Answers

Do you want full debug mode, or do you just want to be able to debug? If the later is the case, just go to the linker options, and turn on the generation of symbolic information (.pdb). This way you can use the debugger in your own code, step through the lines, and look at variables. If you get annoyed by the changes in control flow that the optimizers create, you can go to the compiler options, and turn off optimizations. This way you get to use the debugger AND build in release mode. Once you're happy with your code, you just change the settings back to creating optimized code.

like image 142
Carsten Kuckuk Avatar answered Sep 04 '25 17:09

Carsten Kuckuk


Try passing /NODEFAULTLIB:LIBCMT to the linker.

like image 20
Fredrik Ullner Avatar answered Sep 04 '25 18:09

Fredrik Ullner