简体   繁体   中英

Using static libraries compiled C++ under vs80 (Visual Studio 2005) in a Visual Studio project compiling under c++ vs140 (Visual Studio 2015)

Is it possible to use a C++ static library (.lib) compiled using vs80 (Visual Studio 2005) in a Visual Studio 2015 c++ project (vs140)?

In terms of similar questions, I found 'Can I use a Visual Studio 6 compiled C++ static library in Visual Studio 2008?' , and the answer seems to be 'yes with caveats' in this case, but I am inexperienced with static libraries and was wondering if the same held true for c++ static libraries compiled under vs80 to vs140.

EDIT: I want to add that the library I am attempting to port is fairly small and simple, and doesn't access globals or rely on 'extern C' in any way

Generally you need to build all of your code (including libraries you use) with the exact same compiler. There's no guarantee that code generated by different compilers (not even different minor versions) can be linked together and produce usable results - it may seem to work sometimes, only to turn into nasty and hard to diagnose problems later at runtime, so just don't do that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM