主要是生成的lib工程配置需要修改一下,重新生成lib,再调用此lib就不会出现warning LNK4204,方法如下:
- Project Property Pages -> C++ -> Output Files -> Program Database File Name
- Project Property Pages -> C++ -> General -> Debug Information Format->改用C7 Compatible(/Z7)
Summary
In this short article I’ve shown what you can do about Visual Studio warnings related to PDB files for 3rd party libraries. One option is to stick with the default VS approach - but remember about copying additional .pdb file. The other option is to use /Z7 compiler switch that embeds debug information inside each compilation unit - that way there are no additional files - just one .lib file.
From my experience, I usually set /Z7 for small third party libraries that I need to rebuild and attach to my main project. I did not have any problems so far with /Z7 option. And I can just remember about copying one .lib file and do not care about additional things.