Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to build wxWidgetsets project using Qt Creator?
QtWS25 Last Chance

How to build wxWidgetsets project using Qt Creator?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
15 Posts 3 Posters 325 Views
  • 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.
  • C Offline
    C Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on 13 Mar 2025, 16:24 last edited by
    #2

    You don't link against the wxwidgets libraries so the linker can't find the symbols.
    See LIBS for qmake and target_link_libraries() for cmake.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    1 Reply Last reply
    1
    • K Offline
      K Offline
      Kobid
      wrote on 13 Mar 2025, 16:29 last edited by
      #3

      I don't need to because I have compiled wxWidgets using --disable-shared, this options come from wx-config --cflags --libs but it should be appended at the end for g++ and I don't know how to do it

      C 1 Reply Last reply 13 Mar 2025, 16:40
      0
      • K Kobid
        13 Mar 2025, 16:29

        I don't need to because I have compiled wxWidgets using --disable-shared, this options come from wx-config --cflags --libs but it should be appended at the end for g++ and I don't know how to do it

        C Offline
        C Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 13 Mar 2025, 16:40 last edited by
        #4

        @Kobid said in How to build wxWidgetsets project using Qt Creator?:

        I don't need to because I have compiled wxWidgets using --disable-shared

        This just means you compiled wxwidgets as static lib. You have to link against them if you want to use symbols from there.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2
        • K Offline
          K Offline
          Kobid
          wrote on 13 Mar 2025, 16:48 last edited by
          #5

          Yes, all -L comes from wx-config shell, I think I don't need do this by my self, I mean I didn't have to in CodeBlocks, CodeLite and Visual Studio Code. I think problem is with args order. When I change this (this is how Qt Creator pass it to gcc) from:

          /bin/g++ -DQT_QML_DEBUG `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags --libs` -g  CMakeFiles/SimpleBackupWX2.dir/SimpleBackupMain.cpp.o CMakeFiles/SimpleBackupWX2.dir/ZipProcess.cpp.o CMakeFiles/SimpleBackupWX2.dir/SimpleBackupApp.cpp.o -o SimpleBackupWX2
          

          to (I change it in console of course):

          /bin/g++ -DQT_QML_DEBUG -g  CMakeFiles/SimpleBackupWX2.dir/SimpleBackupMain.cpp.o CMakeFiles/SimpleBackupWX2.dir/ZipProcess.cpp.o CMakeFiles/SimpleBackupWX2.dir/SimpleBackupApp.cpp.o -o SimpleBackupWX2 `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags --libs`
          

          then my project is compiling fine

          J 1 Reply Last reply 13 Mar 2025, 18:34
          0
          • K Offline
            K Offline
            Kobid
            wrote on 13 Mar 2025, 17:48 last edited by Kobid
            #6

            For example, in Visual Studio Code this is how I'm preparing tasks.json which is responsible for building my wxWidgetsets project using g++ and it simply works and even debugging works in this IDE, I don't need to link anything, wx-config is the last argument:

            {
                "tasks": [
                    {
                        "type": "cppbuild",
                        "label": "C/C++: g++ kompiluj aktywny plik",
                        "command": "/usr/bin/g++",
                        "args": [
                            "-fdiagnostics-color=always",
                            "-g",
                            "${fileDirname}/**.cpp",
                            "-o",
                            "${fileDirname}/${fileBasenameNoExtension}",
                            "`/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config",
                            "--cflags",
                            "--libs`"
                        ],
                        "options": {
                            "cwd": "${fileDirname}"
                        },
                        "problemMatcher": [
                            "$gcc"
                        ],
                        "group": {
                            "kind": "build",
                            "isDefault": true
                        },
                        "detail": "Zadanie wygenerowane przez debuger."
                    }
                ],
                "version": "2.0.0"
            }
            
            1 Reply Last reply
            0
            • K Kobid
              13 Mar 2025, 16:48

              Yes, all -L comes from wx-config shell, I think I don't need do this by my self, I mean I didn't have to in CodeBlocks, CodeLite and Visual Studio Code. I think problem is with args order. When I change this (this is how Qt Creator pass it to gcc) from:

              /bin/g++ -DQT_QML_DEBUG `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags --libs` -g  CMakeFiles/SimpleBackupWX2.dir/SimpleBackupMain.cpp.o CMakeFiles/SimpleBackupWX2.dir/ZipProcess.cpp.o CMakeFiles/SimpleBackupWX2.dir/SimpleBackupApp.cpp.o -o SimpleBackupWX2
              

              to (I change it in console of course):

              /bin/g++ -DQT_QML_DEBUG -g  CMakeFiles/SimpleBackupWX2.dir/SimpleBackupMain.cpp.o CMakeFiles/SimpleBackupWX2.dir/ZipProcess.cpp.o CMakeFiles/SimpleBackupWX2.dir/SimpleBackupApp.cpp.o -o SimpleBackupWX2 `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags --libs`
              

              then my project is compiling fine

              J Offline
              J Offline
              JonB
              wrote on 13 Mar 2025, 18:34 last edited by JonB
              #7

              @Kobid
              If you want to figure out why the order of arguments matters, we could understand the command line better if we knew what the

              `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags --libs`
              

              is returning, so we can compare the two actual, full command lines are, and hence how their behaviour differs.

              I don't know how, but there is probably a way to get qmake or cmake alter what order arguments are passed. It's a bit tricky as obviously you have a single "token" returning some mixture of arguments.

              Btw, do you need the --cflags argument to wx-config when you are producing the arguments for just the linker?

              1 Reply Last reply
              0
              • K Offline
                K Offline
                Kobid
                wrote on 13 Mar 2025, 18:40 last edited by
                #8

                Ahh, sorry, you are right, this is what it is returning:

                -I/home/dibo/programowanie/wxWidgetsInstallGTK/lib/wx/include/gtk3-unicode-static-3.2 -I/home/dibo/programowanie/wxWidgetsInstallGTK/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread
                -L/home/dibo/programowanie/wxWidgetsInstallGTK/lib -pthread   /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_xrc-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_qa-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_baseu_net-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_html-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_core-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_baseu_xml-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_baseu-3.2.a -lgthread-2.0 -pthread -lX11 -lXxf86vm -lSM -lxkbcommon -lgtk-3 -lgdk-3 -lpangocairo-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lXtst -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lwxscintilla-3.2 -lexpat -lpcre2-32 -lpng -ljpeg -ltiff -ljbig -lz -lm
                
                J 1 Reply Last reply 13 Mar 2025, 18:47
                0
                • K Kobid
                  13 Mar 2025, 18:40

                  Ahh, sorry, you are right, this is what it is returning:

                  -I/home/dibo/programowanie/wxWidgetsInstallGTK/lib/wx/include/gtk3-unicode-static-3.2 -I/home/dibo/programowanie/wxWidgetsInstallGTK/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread
                  -L/home/dibo/programowanie/wxWidgetsInstallGTK/lib -pthread   /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_xrc-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_qa-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_baseu_net-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_html-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_gtk3u_core-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_baseu_xml-3.2.a /home/dibo/programowanie/wxWidgetsInstallGTK/lib/libwx_baseu-3.2.a -lgthread-2.0 -pthread -lX11 -lXxf86vm -lSM -lxkbcommon -lgtk-3 -lgdk-3 -lpangocairo-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lXtst -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lwxscintilla-3.2 -lexpat -lpcre2-32 -lpng -ljpeg -ltiff -ljbig -lz -lm
                  
                  J Offline
                  J Offline
                  JonB
                  wrote on 13 Mar 2025, 18:47 last edited by
                  #9

                  @Kobid
                  You have

                  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags --libs`")
                  

                  Those are intended to be C++ flags (compiler) and would naturally come early on the command line. I think you want the linker library flags to go into qmake's LIBS or target_link_libraries() for cmake, as @Christian-Ehrlicher said earlier. That would be placed at the end of the linker command line. I know nothing about this, but maybe --cflags only should be used to construct CMAKE_CXX_FLAGS while --libs only should be used to construct LIBS/target_link_libraries()?

                  1 Reply Last reply
                  1
                  • K Offline
                    K Offline
                    Kobid
                    wrote on 13 Mar 2025, 18:53 last edited by
                    #10

                    I thought so that I'll probably need to add all libs in my .pro / cmakelists manually, there is a lot of them, --libs did all of the work in other IDEs. Well, no time to waste, it will be long evening :D

                    J 1 Reply Last reply 13 Mar 2025, 19:29
                    0
                    • K Offline
                      K Offline
                      Kobid
                      wrote on 13 Mar 2025, 19:12 last edited by Kobid
                      #11

                      But maybe there is some nasty workaround? For example in Visual Studio Code I also did a trick, I could not set this as one argument:

                      "args": [
                                      "-fdiagnostics-color=always",
                                      "-g",
                                      "${fileDirname}/**.cpp",
                                      //"${file}",
                                      "-o",
                                      "${fileDirname}/${fileBasenameNoExtension}",
                                      "`/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags --libs`",
                                  ],
                      

                      That is because if VS detect space in JSON argument, it pass to gcc as quoted argument. That is why I splitted it to:

                      "`/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config",
                                     "--cflags",
                                     "--libs`"
                      
                      1 Reply Last reply
                      0
                      • K Kobid
                        13 Mar 2025, 18:53

                        I thought so that I'll probably need to add all libs in my .pro / cmakelists manually, there is a lot of them, --libs did all of the work in other IDEs. Well, no time to waste, it will be long evening :D

                        J Offline
                        J Offline
                        JonB
                        wrote on 13 Mar 2025, 19:29 last edited by JonB
                        #12

                        @Kobid said in How to build wxWidgetsets project using Qt Creator?:

                        I thought so that I'll probably need to add all libs in my .pro / cmakelists manually, there is a lot of them, --libs did all of the work in other IDEs. Well, no time to waste, it will be long evening :D

                        I don't understand. If you can run a command from cmake/qmake to what goes in CMAKE_CXX_FLAGS why can't you do so for LIBS or target_link_libraries() in the same way? Instead of you saying you have to paste in manually. Oh, you mean just doing that has to be across many makefiles? For all I know there might eb a global way. You could wait to see if someone else replies.

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          Kobid
                          wrote on 13 Mar 2025, 19:50 last edited by Kobid
                          #13

                          Woooow!! I always thought that LIBS expect path to existing file etc. I didn't expect that it will accept shell command. I added this:

                          LIBS += `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --libs`
                          

                          And everything is working! App is building and running. Amazing, I can use now my favourite IDE. Thank you guys!!
                          This is my finall .pro file. I must check if I can do same in CMake because I don't know yet which build system I will use:

                          TEMPLATE = app
                          CONFIG += c++17
                          CONFIG -= app_bundle
                          CONFIG -= qt
                          
                          QMAKE_CXXFLAGS += `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags`
                          
                          SOURCES += \
                                  SimpleBackupApp.cpp \
                                  SimpleBackupMain.cpp \
                                  ZipProcess.cpp
                          
                          DISTFILES += \
                              SimpleBackupWx.pro.user
                          
                          HEADERS += \
                              SimpleBackupApp.h \
                              SimpleBackupMain.h \
                              ZipProcess.h
                          
                          INCLUDEPATH += /home/dibo/programowanie/wxWidgetsInstallGTK/include/wx-3.2
                          INCLUDEPATH += /home/dibo/programowanie/wxWidgetsInstallGTK/lib/wx/include/gtk3-unicode-static-3.2
                          
                          LIBS += `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --libs`
                          

                          But don't know why editor is still showing errors and don't recognize some wx classes and overloaded constructors. INCLUDEPATH is responsible for code completion or I must set paths to WX stricte in Qt Creator settings?
                          f32f74d2-54bb-4dc4-9b7a-9c44a07dce89-obraz.png

                          J 1 Reply Last reply 13 Mar 2025, 20:47
                          0
                          • K Kobid
                            13 Mar 2025, 19:50

                            Woooow!! I always thought that LIBS expect path to existing file etc. I didn't expect that it will accept shell command. I added this:

                            LIBS += `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --libs`
                            

                            And everything is working! App is building and running. Amazing, I can use now my favourite IDE. Thank you guys!!
                            This is my finall .pro file. I must check if I can do same in CMake because I don't know yet which build system I will use:

                            TEMPLATE = app
                            CONFIG += c++17
                            CONFIG -= app_bundle
                            CONFIG -= qt
                            
                            QMAKE_CXXFLAGS += `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags`
                            
                            SOURCES += \
                                    SimpleBackupApp.cpp \
                                    SimpleBackupMain.cpp \
                                    ZipProcess.cpp
                            
                            DISTFILES += \
                                SimpleBackupWx.pro.user
                            
                            HEADERS += \
                                SimpleBackupApp.h \
                                SimpleBackupMain.h \
                                ZipProcess.h
                            
                            INCLUDEPATH += /home/dibo/programowanie/wxWidgetsInstallGTK/include/wx-3.2
                            INCLUDEPATH += /home/dibo/programowanie/wxWidgetsInstallGTK/lib/wx/include/gtk3-unicode-static-3.2
                            
                            LIBS += `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --libs`
                            

                            But don't know why editor is still showing errors and don't recognize some wx classes and overloaded constructors. INCLUDEPATH is responsible for code completion or I must set paths to WX stricte in Qt Creator settings?
                            f32f74d2-54bb-4dc4-9b7a-9c44a07dce89-obraz.png

                            J Offline
                            J Offline
                            JonB
                            wrote on 13 Mar 2025, 20:47 last edited by
                            #14

                            @Kobid
                            You can right-click on an orange-underlined function and select something like "Go to definition" or "declaration". See what is there and whether it's the path to the included file you expected.

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              Kobid
                              wrote on 13 Mar 2025, 20:53 last edited by Kobid
                              #15

                              Ok. Finally solved everything. Checked compiler output and wx-config shell execution doesn't work in case of QMAKE_CXXFLAGS like it works in LIBS. So I changed this:

                              QMAKE_CXXFLAGS += `/home/dibo/programowanie/wxWidgetsInstallGTK/bin/wx-config --cflags`
                              

                              To what this command exactly return:

                              QMAKE_CXXFLAGS += -I/home/dibo/programowanie/wxWidgetsInstallGTK/lib/wx/include/gtk3-unicode-static-3.2 -I/home/dibo/programowanie/wxWidgetsInstallGTK/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread
                              

                              And now everything works perfectly, even code completion. Important -D__WXGTK__ was missed because gcc was called without what wx-config return

                              1 Reply Last reply
                              0
                              • K Kobid has marked this topic as solved on 13 Mar 2025, 20:54

                              11/15

                              13 Mar 2025, 19:12

                              • Login

                              • Login or register to search.
                              11 out of 15
                              • First post
                                11/15
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved