Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
2.4.3
-
None
-
Visual Studio 2017 15.9.21
Description
Qt projects which use the testlib module cannot be compiled, because of the following compiler error:
error C2664: "void QTest::setMainSourcePath(const char *,const char *)" : Conversion of argument 2 from "int" to "const char *" not possible
This is caused by the following section inside the qtest.h
#ifdef QT_TESTCASE_BUILDDIR # define QTEST_SET_MAIN_SOURCE_PATH QTest::setMainSourcePath(__FILE__, QT_TESTCASE_BUILDDIR); #else # define QTEST_SET_MAIN_SOURCE_PATH QTest::setMainSourcePath(__FILE__); #endif
Since the QT_TESTCASE_BUILDDIR is defined by the mkspecs\features\testlib_defines.prf but the RegEx in QMake_DEFINES_ extracts only the key without the value, the above if branch is executed but the define is empty.
To avoid that I've included also the values by using DEFINES=/-D(\S+)/$1/, which extracts correctly, but the value is incompatible with MSVC.
The mentioned testlib_defines.prf contains the following content, but since apparently none of the vc templates is used, the alternative (incompatible) value is set.
contains(TEMPLATE, vc.*): DEFINES += QT_TESTCASE_BUILDDIR=\"$$OUT_PWD\" else: DEFINES += QT_TESTCASE_BUILDDIR=$$shell_quote(\"$$OUT_PWD\")
As a workaround I've now excluded the define which works at the moment. DEFINES=/-D((?!QT_TESTCASE_BUILDDIR)\S+)/$1/
Attachments
Issue Links
- depends on
-
QTVSADDINBUG-924 Template project Qt Quick Application using C++14 standard by default even with Qt 6
- Closed
For Gerrit Dashboard: QTVSADDINBUG-762 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
294221,2 | Fix parse of Makefile ignoring macro values | dev | qt-labs/vstools | Status: MERGED | +2 | 0 |