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. Undefined reference to QWidget::styleChange and others
Forum Updated to NodeBB v4.3 + New Features

Undefined reference to QWidget::styleChange and others

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
12 Posts 3 Posters 2.4k Views 1 Watching
  • 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.
  • B bozo6919

    Hi every one,

    I'm blocked in a project with theses errors:

    /usr/bin/ld: moc_Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x188): undefined reference to `QWidget::styleChange(QStyle&)'
    /usr/bin/ld: moc_Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x190): undefined reference to `QWidget::enabledChange(bool)'
    /usr/bin/ld: moc_Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x198): undefined reference to `QWidget::paletteChange(QPalette const&)'
    /usr/bin/ld: moc_Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1a0): undefined reference to `QWidget::fontChange(QFont const&)'
    /usr/bin/ld: moc_Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1a8): undefined reference to `QWidget::windowActivationChange(bool)'
    /usr/bin/ld: moc_Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1b0): undefined reference to `QWidget::languageChange()'
    collect2: error: ld returned 1 exit status
    

    I have already research on internet why I have theses errors but I've found nothing execepted clean, qmake and re-build, but It doesn't work... :(

    Window.hpp:

    #include <Qt/qgraphicsview.h>
    #include <Qt/qgraphicsscene.h>
    
    class Window : public QGraphicsView
    {
    	Q_OBJECT
    
    public:
    	Window(QGraphicsScene *);
        ~Window();
    };
    

    Window.cpp:

    #include "Window.hpp"
    
    Window::Window(QGraphicsScene *scene)
    	: QGraphicsView(scene)
    {
    	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    	setFocusPolicy(Qt::NoFocus);
    	setStyleSheet("QGraphicsView {background: 'black';}");
    	resize(640, 640);
    	show();
    }
    
    Window::~Window()
    {
    }
    
    int main()
    {
    	return 0;
    }
    

    project.pro:

    DEFINES += QT_DEPRECATED_WARNINGS
    QT += widgets gui core
    
    INCLUDEPATH += ./include
    INCLUDEPATH += ../../core/include
    
    HEADERS += include/Window.hpp
    SOURCES += source/Window.cpp
    

    Thanks in advance.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @bozo6919 What Qt version do you use and how did you install it?

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bozo6919
      wrote on last edited by bozo6919
      #3

      @jsulm I use Qt 5.11.
      I have install it normally ^^ I have already use this version for many other projects.

      Sorry for my English ^^'

      jsulmJ 1 Reply Last reply
      0
      • B bozo6919

        @jsulm I use Qt 5.11.
        I have install it normally ^^ I have already use this version for many other projects.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by jsulm
        #4

        @bozo6919 "normally" can be using Qt Online or Offline installer or your distribution packages.
        Are you sure you're using Qt5? Because in Qt5.12 (and I guess Qt5.11) there is no paletteChange for example. But there is such thing in Qt3!
        https://doc.qt.io/archives/3.3/qwidget.html#paletteChange

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        B 1 Reply Last reply
        1
        • jsulmJ jsulm

          @bozo6919 "normally" can be using Qt Online or Offline installer or your distribution packages.
          Are you sure you're using Qt5? Because in Qt5.12 (and I guess Qt5.11) there is no paletteChange for example. But there is such thing in Qt3!
          https://doc.qt.io/archives/3.3/qwidget.html#paletteChange

          B Offline
          B Offline
          bozo6919
          wrote on last edited by
          #5

          @jsulm Yes I'm sure

          And I have only Qt 5.11 and Qt 5.12 installed in my computer. I have already seen in another forum that theses functions are from Qt 3, but I don't know why.

          Sorry for my English ^^'

          jsulmJ 1 Reply Last reply
          0
          • B bozo6919

            @jsulm Yes I'm sure

            And I have only Qt 5.11 and Qt 5.12 installed in my computer. I have already seen in another forum that theses functions are from Qt 3, but I don't know why.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @bozo6919 Can you post the compiler output?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bozo6919
              wrote on last edited by
              #7

              @jsulm

              clean:

              14:01:38: Running steps for project qt...
              14:01:38: Starting: "/usr/bin/make" clean -j4
              rm -f moc_predefs.h
              rm -f Window.o
              rm -f *~ core *.core
              14:01:38: The process "/usr/bin/make" exited normally.
              14:01:38: Elapsed time: 00:00.
              

              qmake:

              14:02:18: Running steps for project qt...
              14:02:18: Starting: "/home/leo7418/Qt/5.12.0/gcc_64/bin/qmake" /home/leo7418/OOP_arcade_2018/lib/qt/qt.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
              14:02:18: The process "/home/leo7418/Qt/5.12.0/gcc_64/bin/qmake" exited normally.
              14:02:18: Starting: "/usr/bin/make" -f /home/leo7418/OOP_arcade_2018/lib/build-qt-Desktop_Qt_5_12_0_GCC_64bit-Debug/Makefile qmake_all
              make: Nothing to be done for 'qmake_all'.
              14:02:18: The process "/usr/bin/make" exited normally.
              14:02:18: Elapsed time: 00:00.
              

              compile:

              14:02:50: Running steps for project qt...
              14:02:50: Configuration unchanged, skipping qmake step.
              14:02:50: Starting: "/usr/bin/make" -j4
              g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../qt -I. -I../qt/include -I../../core/include -I../../../Qt/5.12.0/gcc_64/include -I../../../Qt/5.12.0/gcc_64/include/QtWidgets -I../../../Qt/5.12.0/gcc_64/include/QtGui -I../../../Qt/5.12.0/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I../../../Qt/5.12.0/gcc_64/mkspecs/linux-g++ -o Window.o ../qt/source/Window.cpp
              g++ -Wl,-rpath,/home/leo7418/Qt/5.12.0/gcc_64/lib -o qt Window.o   -L/home/leo7418/Qt/5.12.0/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread   
              /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: in function `_start':
              (.text+0x24): undefined reference to `main'
              /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x188): undefined reference to `QWidget::styleChange(QStyle&)'
              /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x190): undefined reference to `QWidget::enabledChange(bool)'
              /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x198): undefined reference to `QWidget::paletteChange(QPalette const&)'
              /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1a0): undefined reference to `QWidget::fontChange(QFont const&)'
              /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1a8): undefined reference to `QWidget::windowActivationChange(bool)'
              /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1b0): undefined reference to `QWidget::languageChange()'
              collect2: error: ld returned 1 exit status
              make: *** [Makefile:257: qt] Error 1
              14:02:51: The process "/usr/bin/make" exited with code 2.
              Error while building/deploying project qt (kit: Desktop Qt 5.12.0 GCC 64bit)
              When executing step "Make"
              14:02:51: Elapsed time: 00:01.
              

              Sorry for my English ^^'

              jsulmJ 1 Reply Last reply
              0
              • B bozo6919

                @jsulm

                clean:

                14:01:38: Running steps for project qt...
                14:01:38: Starting: "/usr/bin/make" clean -j4
                rm -f moc_predefs.h
                rm -f Window.o
                rm -f *~ core *.core
                14:01:38: The process "/usr/bin/make" exited normally.
                14:01:38: Elapsed time: 00:00.
                

                qmake:

                14:02:18: Running steps for project qt...
                14:02:18: Starting: "/home/leo7418/Qt/5.12.0/gcc_64/bin/qmake" /home/leo7418/OOP_arcade_2018/lib/qt/qt.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
                14:02:18: The process "/home/leo7418/Qt/5.12.0/gcc_64/bin/qmake" exited normally.
                14:02:18: Starting: "/usr/bin/make" -f /home/leo7418/OOP_arcade_2018/lib/build-qt-Desktop_Qt_5_12_0_GCC_64bit-Debug/Makefile qmake_all
                make: Nothing to be done for 'qmake_all'.
                14:02:18: The process "/usr/bin/make" exited normally.
                14:02:18: Elapsed time: 00:00.
                

                compile:

                14:02:50: Running steps for project qt...
                14:02:50: Configuration unchanged, skipping qmake step.
                14:02:50: Starting: "/usr/bin/make" -j4
                g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../qt -I. -I../qt/include -I../../core/include -I../../../Qt/5.12.0/gcc_64/include -I../../../Qt/5.12.0/gcc_64/include/QtWidgets -I../../../Qt/5.12.0/gcc_64/include/QtGui -I../../../Qt/5.12.0/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I../../../Qt/5.12.0/gcc_64/mkspecs/linux-g++ -o Window.o ../qt/source/Window.cpp
                g++ -Wl,-rpath,/home/leo7418/Qt/5.12.0/gcc_64/lib -o qt Window.o   -L/home/leo7418/Qt/5.12.0/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread   
                /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: in function `_start':
                (.text+0x24): undefined reference to `main'
                /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x188): undefined reference to `QWidget::styleChange(QStyle&)'
                /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x190): undefined reference to `QWidget::enabledChange(bool)'
                /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x198): undefined reference to `QWidget::paletteChange(QPalette const&)'
                /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1a0): undefined reference to `QWidget::fontChange(QFont const&)'
                /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1a8): undefined reference to `QWidget::windowActivationChange(bool)'
                /usr/bin/ld: Window.o:(.data.rel.ro._ZTV6Window[_ZTV6Window]+0x1b0): undefined reference to `QWidget::languageChange()'
                collect2: error: ld returned 1 exit status
                make: *** [Makefile:257: qt] Error 1
                14:02:51: The process "/usr/bin/make" exited with code 2.
                Error while building/deploying project qt (kit: Desktop Qt 5.12.0 GCC 64bit)
                When executing step "Make"
                14:02:51: Elapsed time: 00:01.
                
                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @bozo6919 said in Undefined reference to QWidget::styleChange and others:

                /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: in function _start': (.text+0x24): undefined reference to main'

                You should fix this issue first: move your main() function in its own file

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                B 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @bozo6919 said in Undefined reference to QWidget::styleChange and others:

                  /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: in function _start': (.text+0x24): undefined reference to main'

                  You should fix this issue first: move your main() function in its own file

                  B Offline
                  B Offline
                  bozo6919
                  wrote on last edited by
                  #9

                  @jsulm Sorry, I have forgot to put the main (At first my project is a library). But with the main, is the same

                  Sorry for my English ^^'

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Hi,

                    Are you trying to build an old project ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    B 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Hi,

                      Are you trying to build an old project ?

                      B Offline
                      B Offline
                      bozo6919
                      wrote on last edited by
                      #11

                      @SGaist Hi, no I’ve create this project this monday.
                      I think my Qt version is broken because when I try to compile my project in my second computer, this work :/

                      Sorry for my English ^^'

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        It looks like it. Since it's the moc related code that has issue, I would check what version is run when you try to build your project.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        • Login

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