简体   繁体   中英

Compiling with Microsoft Visual C++ 2013 under Visual Studio 2015

I want to use Qt 5.5 with Microsoft Visual Studio 2015. But, the last compatible version of the Microsoft compiler with Qt is MSVC2013. So, I want to tell Visual 2015 to use "legacy" mode to compile with an older version of Microsoft compiler.

How to do that?

When I use MSVC2015 I get this error :

Gravité Code    Description Projet  Fichier Ligne
Erreur  LNK2019 symbole externe non résolu "__declspec(dllimport) char const 

* __cdecl std::_Winerror_map(int)" (__imp_?_Winerror_map@std@@YAPBDH@Z) 

référencé dans la fonction "public: virtual class   std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::_System_error_category::message(int)const " (?message@_System_error_category@std@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@H@Z)    helloworld  C:\Users\roman\Documents\QtTest\bin\qtmaind.lib(qtmain_win.obj) 1

I think it's because Qt Lib are compiled for MSVC2013

You're trying to use Qt built for VS 2013 with code built with VS 2015. This will never work - it's not even a problem with Qt, but with C++ ABI changing between VS versions.

All C++ code must be compiled with the same Visual Studio version .

The compiler has no "legacy mode" features as such (outside of handful of minor switch, such a wchar_t support etc.).

If VS2013 is installed, you can use the VS2015 IDE and change the toolset for the project (under project settings).

If all else fails, you could also recompile QT with VS2015.


Note: the error you see is because there were breaking changes in the C++ runtime ABI (what it exported and not, etc.). The new runtime dll(s) no longer exports some of the exception mechanics. Recompiling the target with the corresponding toolchain will take care of this.

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