[Qgis-user] Error compiling QGIS 2.18.8: "QStringLiteral was not declared in this scope"

Larry Shaffer larrys at dakotacarto.com
Wed May 24 14:33:00 PDT 2017


Hi Hernán,

It looks like someone backported a fix from QGIS 2.99 (upcoming 3.0
release) code branch, where QStringLiteral() is preferred over QString()
because it is available in Qt5, and other reasons. The use of
QStringLiteral in 2.x code bases needs removed (as Jürgen mentioned).

Side note: I have gotten around it for C++ plugin development, where I
wanted to compile the same plugin code for QGIS 2 and 3 while focusing more
on QGIS 3 coding style/standards, by using the following macro:

#ifndef QStringLiteral
// Add define for Qt4
// Source code is assumed to be encoded in UTF-8 (as per Qt5 macro)
//# define QStringLiteral(str) QString::fromUtf8(str, sizeof(str) - 1)
// But... that macro does not appear to work on Linux with GCC,
// Just add QString() stub instead
# define QStringLiteral(str) QString(str)
#endif

This *could* be added to 2.x branches (to guard against this type of
error), but there is the problem that there is no standard base included
header file, e.g. qgis.h and qgsconfig.h are not always included. So, no
clear place to put the macro.

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota
----------------------------------
Boundless Desktop and QGIS Support/Development
Boundless Spatial - http://boundlessgeo.com
lshaffer at boundlessgeo.com


Larry Shaffer
Dakota Cartography
Black Hills, South Dakota
----------------------------------
Boundless Desktop and QGIS Support/Development
Boundless Spatial - http://boundlessgeo.com
lshaffer at boundlessgeo.com

On Wed, May 24, 2017 at 3:21 PM, Jürgen E. Fischer <jef at norbit.de> wrote:

> Hi Hernán,
>
> On Wed, 24. May 2017 at 22:56:49 +0200, Hernán De Angelis wrote:
> > I am trying to compile 2.18.8 from source. This is my usual way of
> > installing QGIS and I never experience any dramatic problems. However,
> this
> > time I keep getting the following cryptic error, which I cannot seem to
> get
> > around:
>
> Apply af8fb04f.
>
>
> Jürgen
>
>
> --
> Jürgen E. Fischer           norBIT GmbH             Tel.
> +49-4931-918175-31
> Dipl.-Inf. (FH)             Rheinstraße 13          Fax.
> +49-4931-918175-50
> Software Engineer           D-26506 Norden
> http://www.norbit.de
> QGIS release manager (PSC)  Germany                    IRC: jef on FreeNode
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170524/09784ec9/attachment.html>


More information about the Qgis-user mailing list