Re: #pragma comment lib by Cezary
Cezary
Sun Apr 13 04:20:07 CDT 2008
Hello,
>> Otherwise you will have to use ,,/NODEFAULTLIB:MYLIB MYLIBd.lib''
>> when linking debug version of your app. This causes some overtyping
>> then using lib names in command line explicitly.
>
> Why do you need to explicit remove MYLIB link when build a debug
> version? Confused. In your code, if you use macro DEBUG in debug
> version compile, the code,
>
> #pragma comment(lib, "MYLIB")
>
> will not be seen, and there should not be any conflict? Could you
> clarify please?
I wrote ,,otherwise''. I meant single ,,#pragma comment(lib, ...)''
(your example) as opposite to my conditional ,,#ifdef'' example.
1. ,,otherwise'' situation
#pragma comment(lib, "MYLIB") /* you should remove */
/* MYLIB by /NODEFAULTLIB */
/* linker option */
/* if you want link with */
/* debug version (MYLIBd) */
2. my example
#ifdef DEBUG
#pragma comment(lib, "MYLIBd")
#else /* #ifdef DEBUG */
#pragma comment(lib, "MYLIB")
#endif /* #ifdef DEBUG */
Here, if you want to use debug version (MYLIBd) you will not need to
remove explicitly (this is what you wrote above).
-- best regards
Cezary Noweta