Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QT 5.15.0 MSVC2015 program compile error: error C2664: "void QPainter::fillPath(const QPainterPath &,const QBrush &)" : Conversion of argument 1 from "int" to "const QPainterPath &" not possible

    General and Desktop
    3
    11
    562
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Harald Oehlmann last edited by

      Dear Qt community,

      first of all a big sorry for this post. It is the last question before returning to working QT5.7.1. I am a very very novice qt user.

      I am maintaining the Windows build of the zint bar code generation library. The GUI is made using QT. In 2018, I managed after 1 week of research to build a static qt executable using ms-vc2015 and qt5.7.1 for 32 bit.
      I have a new laptop and tried recent qt 5.15.0 with a similar receipe.


      Unfortunately, I get the following compile error:

      .\qzint.cpp(382): error C2664: "void QPainter::fillPath(const
      QPainterPath &,const QBrush &)" : Konvertierung von Argument 1 von "int"
      in "const QPainterPath &" nicht möglich
      .\qzint.cpp(382): note: Ursache: Konvertierung von "int" in "const
      QPainterPath" nicht möglich
      .\qzint.cpp(382): note: Der nicht definierte Typ "QPainterPath" wird
      verwendet.
      c:\qt\5.15.1static\include\qtgui\qpainter.h(69): note: Siehe Deklaration
      von "QPainterPath"
      

      May I translate the German error messages:

      .\qzint.cpp(382): error C2664: "void QPainter::fillPath(const
      QPainterPath &,const QBrush &)" : Conversion of argument 1 from "int" to
      "const QPainterPath &" not possible
      .\qzint.cpp(382): note: Reason: Conversion of argument 1 from "int" to
      "const QPainterPath &" not possible
      .\qzint.cpp(382): note: The undefined type "QPainterPath" is used.
      c:\qt\5.15.1static\include\qtgui\qpainter.h(69): note: see declaration
      of "QPainterPath"
      

      The steps are as follows:

      • Go to: https://www.qt.io/offline-installers

      • Download the zip "Qt 5.15.x source packages" (nearly 1 GB):
        http://download.qt.io/official_releases/qt/5.15/5.15.0/single/qt-everywhere-src-5.15.0.zip

      • Unzip to C:\qt resulting in having the source in c:\qt\qt-everywhere-src-5.15.0

      • Install Python (ActivePython-3.7.4.0000-win64-x64-e0b99d60.msi) and make it available within the path.

      • Start the VS2015 x86 native console by the start menu entry:
        Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x86 Native Tools-Eingabeaufforderung

      • cd C:\qt\qt-everywhere-src-5.15.0
      • configure.bat -static -release -prefix c:\qt\5.15.0static -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -mp
        One may set another destination folder after the -prefix option.
        Attention, the upper command is one long line.
      • nmake
      • nmake install
        The last 3 commands run around 3 hours.
        Make sure, that python may be found in the path.
      • the huge source folder may be deleted to save around 6GB of space.
      • Start in the start menu: "VS2015 x86 Native Tools-Eingabeaufforderung"
      • set QTDIR=C:\Qt\5.15.0static
      • set PATH=C:\Qt\5.15.0static\bin;%PATH%
      • set QMAKESPEC=win32-msvc
      • cd $ZH
      • cd backend_qt
      • qmake backend_qt.pro
      • nmake clean
      • nmake release

      The used program to compile may be downloaded here:

      https://sourceforge.net/projects/zint/files/zint/2.9.0/zint-2.9.0_win32_cmd_tcl.zip/download


      Thank you for any hint.

      Thank you and best regards,
      Harald

      1 Reply Last reply Reply Quote 1
      • mrjj
        mrjj Lifetime Qt Champion last edited by mrjj

        Hi and welcome to the forums

        What happens if you just compile zint with 5.15 nonstatic.
        does it still fail?

        Im wondering if its just a change in Qt between 5.7 and 5.15 or
        its due to being static.

        Also tried to download the file in the link but it was a binary.
        I wonder was is in line .\qzint.cpp(382)

        H 1 Reply Last reply Reply Quote 0
        • Chris Kawa
          Chris Kawa Moderators last edited by Chris Kawa

          @Harald-Oehlmann Looks like you're just missing #include <QPainterPath> in qzint.cpp.

          Btw you can cut that 3h compilation time if you exclude modules you don't use by using -skip <module_name> in your configure step. I usually leave about 4-5 core modules and it compiles in about 15 minutes.

          mrjj 1 Reply Last reply Reply Quote 2
          • mrjj
            mrjj Lifetime Qt Champion @Chris Kawa last edited by

            @Chris-Kawa
            How many cores do you use ?
            15 min is very good time :=)

            1 Reply Last reply Reply Quote 0
            • Chris Kawa
              Chris Kawa Moderators last edited by Chris Kawa

              @mrjj Just your regular off the shelf 8 core i9 (16 threads). That's only the compilation step, excluding configure and install. As I said I only build core, widgets and a handful of smaller modules because that's all I need. The web and QML stuff can easily stretch that to hours.

              mrjj 1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion @Chris Kawa last edited by

                @Chris-Kawa
                Ok, i still run C4/T8 at home so 15 mins just seemed awesome to me but
                i guess i should also try to exclude the QML stuff. Was not aware it would be that much extra :)
                Thx

                1 Reply Last reply Reply Quote 0
                • H
                  Harald Oehlmann @mrjj last edited by Harald Oehlmann

                  @mrjj Thank you for the answer. This is highly appreciated.
                  May I answer to your questions ?

                  What happens if you just compile zint with 5.15 nonstatic. does it still fail?

                  Do you mean to recompile qt without the static option ? This takes 3 hours of work. I am sorry, but this is not the aim and much work.

                  Im wondering if its just a change in Qt between 5.7 and 5.15 or its due to being static.

                  I have no idea

                  Also tried to download the file in the link but it was a binary.

                  The link goes to the release archive of zint 2.9. It is a .tar.gz file. I am sorry, if this is not suitable for you.

                  I wonder was is in line .\qzint.cpp(382)

                  There is the following line:

                  painter.fillPath(pt, QBrush(m_fgColor));
                  

                  The whole context is as follows:

                              QPainterPath pt;
                              pt.moveTo(hex->x, hex->y + (1.0 * radius));
                              pt.lineTo(hex->x + (0.86 * radius), hex->y + (0.5 * radius));
                              pt.lineTo(hex->x + (0.86 * radius), hex->y - (0.5 * radius));
                              pt.lineTo(hex->x, hex->y - (1.0 * radius));
                              pt.lineTo(hex->x - (0.86 * radius), hex->y - (0.5 * radius));
                              pt.lineTo(hex->x - (0.86 * radius), hex->y + (0.5 * radius));
                              pt.lineTo(hex->x, hex->y + (1.0 * radius));
                              painter.fillPath(pt, QBrush(m_fgColor));
                  

                  Thank you again,
                  Harald


                  As the Forum allows only one post by me per day, I try to add the other answers here:

                  @Chris Kawa:

                  Thank you, that sounds great. Do you have exact instructions how to do that and how to modify the recipe? Remark that I use QT only for that and the big memory footprint on my harddisk also puzzles me...

                  mrjj 1 Reply Last reply Reply Quote 1
                  • mrjj
                    mrjj Lifetime Qt Champion @Harald Oehlmann last edited by

                    Hi

                    do you mean to recompile qt without the static option?

                    No no, just compile the app with a normal Qt.
                    To see it that just works.

                    I assume you do have
                    #include <QPainterPath> in qzint.cpp. as Chris Kawa asks?

                    • the link goes to the release archive of zint 2.9. It is a .tar.gz file.

                    I get which seems to be a release and not source code ?

                    alt text
                    https://sourceforge.net/projects/zint/files/zint/2.9.0/zint-2.9.0_win32_cmd_tcl.zip/download

                    ps. I bumped you so you should be able to answer faster/more.

                    H 1 Reply Last reply Reply Quote 0
                    • H
                      Harald Oehlmann @mrjj last edited by Harald Oehlmann

                      @mrjj Thank you for the reply:

                      First, I want express again my appolyse to contact here as a novice user.

                      Sorry, the URL is:
                      https://sourceforge.net/projects/zint/files/zint/2.9.0/zint-2.9.0.tar.gz/download

                      Sorry, I don't know what a "normal Qt" is. Is the QT used by me not normal ?
                      I suppose, the static build is the most used and most normal out there as anything else leeds into DLL hell we had before within the project.

                      No, I don't see QPainterPath as include. The contained includes within the file are:

                      #include "qzint.h"
                      #include <stdio.h>
                      #include <math.h>
                      #include <QFontMetrics>
                      

                      qzint.h containes the following includes:

                      #include <QColor>
                      #include <QPainter>
                      

                      May I add the proposed include somewhere ?
                      After which other include ?

                      Remark, that it should still compile with QT 5.12.4, what is currently used on Linux Operating System. Currently, it compiles there without any reported issues.

                      May I also add some extract from the eventually relevant backend_qt.pro file:

                      TEMPLATE = lib
                      CONFIG += staticlib
                      macx{
                      	CONFIG -= dll
                      	CONFIG += lib_bundle
                      }
                      
                      TARGET = QtZint
                      

                      Thank you,
                      Harald

                      mrjj 1 Reply Last reply Reply Quote 0
                      • mrjj
                        mrjj Lifetime Qt Champion @Harald Oehlmann last edited by mrjj

                        Hi
                        Np :)
                        Yes just add the include and see if that helps. ( in cpp should do it )

                        By normal, i just mean the one you normally get installed from the site.
                        Its none static and it was only to see if it just runs.

                        But you seem to have tested that already

                        • Remark, that it should still compile with QT 5.12.4, what is currently used on Linux Operating System. Currently, it compiles there without any reported issues.
                        H 1 Reply Last reply Reply Quote 0
                        • H
                          Harald Oehlmann @mrjj last edited by Harald Oehlmann

                          @mrjj Thank you a lot, that vanished the issue.
                          The error is gone.

                          Now, I have only a remaining link error:

                           link /NOLOGO /DYNAMICBASE /NXCOMPAT /OPT:REF /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\qtZint.exe @C:\Users\oehhar\AppData\Local\Temp\nmEB22.tmp
                          LINK : fatal error LNK1181: Eingabedatei "Qt5Core.lib" kann nicht geöffnet werden.
                          NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"": Rückgabe-Code "0x49d"
                          Stop.
                          

                          The required library is present in "c:\qt\5.15.0static\lib".
                          Thus, I suppose, there is a path issue.

                          The set environment variables are:

                          set QTDIR=C:\Qt\5.15.0static
                          set PATH=C:\Qt\5.15.0static\bin;%PATH%
                          set QMAKESPEC=win32-msvc
                          

                          Adding:

                          set QMAKE_LIBDIR=C:\Qt\5.15.0static\lib
                          

                          did not help.

                          The relevant frontend_qt.pro line is:

                          LIBS += -lQtZint -lQt5Core
                          QMAKE_LIBDIR += ../backend_qt/release
                          

                          Adding here:

                          QMAKE_LIBDIR += C:/qt/5.15.1static/lib
                          

                          did the job, but is not very plesant to the other supported platforms.
                          In addition, it points to my local laptop.
                          But if this is required, it is required.

                          Thank you all for solving this and best regards,
                          Harald

                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post