Qt5.15.2 amd64 Build from src - Missing symbol export "_cdecl QUnhandledException"
-
wrote on 20 Feb 2022, 17:27 last edited by
Hi,
After build in amd64 with MSVC2019 Qt5.15.2 from source, I made the observation that public _cdecl QUnhandledException symbol was not exported.
The source are from https://download.qt.io/archive/qt/5.15/5.15.2/single/
And the configuration cmd windows script is as this :
CALL "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Auxiliary/Build/vcvarsall.bat" amd64 set "CMAKE_ROOT=C:\CMake\bin" set "NINJA_ROOT=C:\ninja-win" set "PERL_ROOT=C:\Strawberry\perl\bin" set PATH=%CMAKE_ROOT%;%PATH% set PATH=%NINJA_ROOT%;%PATH% set PATH=%PERL_ROOT%;%PATH% set PATH=C:\Python311-amd64;%PATH% rem Check if the tools are in PATH where perl.exe where python.exe where cmake.exe where ninja.exe set "MY_INSTALL_PATH=qt-5.15.2-build-vs2019" set CL=/MP cmake -G "Visual Studio 16 2019" configure.bat -prefix %MY_INSTALL_PATH% -release -force-debug-info -platform win32-msvc -opensource -confirm-license -nomake tests -nomake examples
The differences is in Qt5Core.dll as shown on attached picture
And it results in error LNK 2001 unresolved external Symbol.
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: virtual __cdecl QUnhandledException::~QUnhandledException(void)" (__imp_??1QUnhandledException@@UEAA@XZ) Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: __cdecl QUnhandledException::QUnhandledException(void)" (__imp_??0QUnhandledException@@QEAA@XZ) Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: void __cdecl QFutureInterfaceBase::reportException(class QException const &)" (__imp_?reportException@QFutureInterfaceBase@@QEAAXAEBVQException@@@Z)
Sample code was taken here qtconcurrentrun.html#using-member-functions
#include <iostream> #include <QtCore/QObject> #include <QtCore/QtCore> #include <QtCore/QFuture> #include <QtCore/QUnhandledException> #include <QtConcurrent/QtConcurrentVersion> #include <QtConcurrent/QtConcurrent> #include <QtConcurrent/QtConcurrentRun> #include <QtConcurrent/QtConcurrentMap> int main() { // from https://doc.qt.io/qt-5/qtconcurrentrun.html#using-member-functions QByteArray bytearray = "Hello World!"; // QFuture<QList<QByteArray> > future = QtConcurrent::run(bytearray, &QByteArray::split, ','); //QList<QByteArray> result = future.result(); }
-
wrote on 20 Feb 2022, 19:18 last edited by NiVa99
By changing configure option like this
CALL "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Auxiliary/Build/vcvarsall.bat" amd64 set "CMAKE_ROOT=C:\CMake\bin" set "NINJA_ROOT=C:\ninja-win" set "PERL_ROOT=C:\Strawberry\perl\bin" set PATH=%CMAKE_ROOT%;%PATH% set PATH=%NINJA_ROOT%;%PATH% set PATH=%PERL_ROOT%;%PATH% set PATH=C:\Python311-amd64;%PATH% rem Check if the tools are in PATH where perl.exe where python.exe where cmake.exe where ninja.exe set "MY_INSTALL_PATH=qt-5.15.2-build-vs2019" set CL=/MP cmake -G "Visual Studio 16 2019" :: configure.bat -prefix %MY_INSTALL_PATH% -release -force-debug-info -platform win32-msvc -opensource -confirm-license -nomake tests -nomake examples configure.bat -prefix %MY_INSTALL_PATH% **-developer-build** -release -force-debug-info -platform win32-msvc -opensource -confirm-license -nomake tests -nomake examples
-
You compile Qt without exceptions support and then wonder why an exception is not in your dll? Wow.
-
wrote on 20 Feb 2022, 20:33 last edited by
think -developer-build option is the main diff. I had tested with exceptions option and Qt5Core did not embbed QUnhandled::exception. Tested today.
-
@NiVa99 said in Qt5.15.2 amd64 Build from src - Missing symbol export "_cdecl QUnhandledException":
think -developer-build option is the main diff. I
No, see the header of qexception.h - you disable a feature and Qt just does what you asked for.
1/5