[Qgis-developer] Fwd: [Qt5] Compilation problems on windows
Anatoliy Golubev
darth.naihil at gmail.com
Mon Nov 14 14:54:24 PST 2016
---------- Forwarded message ----------
From: Anatoliy Golubev <darth.naihil at gmail.com>
Date: 2016-11-15 1:49 GMT+03:00
Subject: [Qt5] Compilation problems on windows
To: qgis-developer <qgis-developer at lists.osgeo.org>
Hi devs!
I compiled QGIS 2.18 with Qt 5.3.2 and Visual Studio 2013. There are
some problems:
0. VS 2013 dont support `noexcept` keyword and throws
qgsfield.h(383): error C3646: 'noexcept' : unknown override specifier
Setting USE_CXX_11 to FALSE manually lead to following error:
3> Generating ui_qgsrelationreferenceconfigdlgbase.h
4>C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\include\xkeycheck.h(211): warning C4005: 'noexcept' : macro
redefinition
4> command-line arguments : see previous definition of 'noexcept'
4>C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\include\xkeycheck.h(212): warning C4005: 'nullptr' : macro
redefinition
4> command-line arguments : see previous definition of 'nullptr'
4>C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\include\xkeycheck.h(246): warning C4005: 'override' : macro
redefinition
4> command-line arguments : see previous definition of 'override'
4>C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\include\xkeycheck.h(250): fatal error C1189: #error : The C++
Standard Library forbids macroizing keywords. Enable warning C4005 to
find the forbidden macro.
I added this defines to CMakeLists.txt to disable C1189 error and
redefine only noexcept:
ELSEIF (MSVC AND MSVC_VERSION GREATER 1600)
SET(USE_CXX_11 TRUE)
+ ADD_DEFINITIONS("-D_ALLOW_KEYWORD_MACROS=1")
+ ADD_DEFINITIONS("-Dnoexcept=")
1. Q_WS_* macroses changed to Q_OS_* in Qt5
Q_WS_WIN macro in 'src/core/geometry/qgsgeometry.cpp:48' breaks
compilation on Windows.
2. Linking of all executables fails with:
2>MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol
_WinMain at 16 referenced in function ___tmainCRTStartup
2>D:\Projects\QGIS\build\output\Release\qgis_help.exe : fatal error
LNK1120: 1 unresolved externals
It is related to CMake Warning:
CMake Warning (dev) in src/helpviewer/CMakeLists.txt:
Policy CMP0020 is not set: Automatically link Qt executables to qtmain
target on Windows. Run "cmake --help-policy CMP0020" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Added 'CMAKE_POLICY (SET CMP0020 NEW)' to following files:
- src/app/CMakeLists.txt
- src/browser/CMakeLists.txt
- src/helpviewer/CmakeLists.txt
Setting this to root CMakeLists.txt has no effect, dont know why.
3. Running debug build fails with assert in method 'void
QgsMapLayerModel::addLayers( const QList<QgsMapLayer *>& layers )'
line 96 (layers list is empty).
qgis output - http://pastebin.com/zaHv0hpz
call stack - http://pastebin.com/PVV8bsLW
Adding 'if ( layers.isEmpty() ) return;' fix this.
4. Multiple warnings:
6>qgis_core.lib(qgis_core.dll) : warning LNK4006: "public: __thiscall
QVector<class QVariant>::QVector<class QVariant>(class QVector<class
QVariant> const &)" (??0?$QVector at VQVariant@@@@QAE at ABV0@@Z) already
defined in qgsgraph.obj; second definition ignored
6>qgis_core.lib(qgis_core.dll) : warning LNK4006: "public: __thiscall
QVector<class QVariant>::~QVector<class QVariant>(void)"
(??1?$QVector at VQVariant@@@@QAE at XZ) already defined in qgsgraph.obj;
second definition ignored
6>qgis_core.lib(qgis_core.dll) : warning LNK4006: "public: class
QVector<class QVariant> & __thiscall QVector<class
QVariant>::operator=(class QVector<class QVariant> const &)"
(??4?$QVector at VQVariant@@@@QAEAAV0 at ABV0@@Z) already defined in
qgsgraph.obj; second definition ignored
6>qgis_core.lib(qgis_core.dll) : warning LNK4006: "public: __thiscall
QVector<class QVariant>::QVector<class QVariant>(void)"
(??0?$QVector at VQVariant@@@@QAE at XZ) already defined in qgsgraph.obj;
second definition ignored.
Thats all ^_^
More information about the Qgis-developer
mailing list