Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. "Undefined reference to"
Qt 6.11 is out! See what's new in the release blog

"Undefined reference to"

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 4 Posters 1.3k Views 2 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.
  • C Offline
    C Offline
    Chanchan
    wrote on last edited by
    #1

    Hi !!
    I got a problem on one of my code :)
    I use this line :

    m_module.insert(std::pair<QString, AbstractGUIModule*>("Source Video", new VideoModule(DLTCommSetup::DEFAULT_DLT_ADDRESS_GND, QString().number(DLTCommSetup::DEFAULT_RTSP_PORT), DLTCommSetup::DEFAULT_RTSP_MEDIA, VERBOSE8MODULES, parent())));
    

    I got the error : "Undefined reference to 'DLTCommSetup::DEFAULT_DLT_ADDRESS_GND' "

    in my header DLTCommSetup :

    static constexpr char DEFAULT_ADDRESS_GND[13]="192.168.x.xx"
    

    So it is well defined here, if needed here is my VideoModule constructor :

    VideoModule::VideoModule(QString ip, QString port, QString media, bool verbose, QObject* interface_qml) :
    AbstractGUIModule("Source Video", verbose, interface_qml), m_video_state(VideoState::OFF), m_current_mode(Mode::GROUND), m_video_packet_flag(false), m_media_player("VideoPlayer")
    

    I dont understand where the "undefined reference" comes from :/
    Thanks for help :D

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chanchan
      wrote on last edited by
      #10

      It's okey, I found my problem ! I called the wrong module where my function is, that caused (I dont know why) that error
      Qt Magic !
      Thx for your help :)

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi
        Make sure you don't have cyclic includes.
        That can also give undefined errors.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chanchan
          wrote on last edited by
          #3

          Ichecked and it is okey, any cyclic include in my project :/

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

            Hi,

            Did you declare DEFAULT_ADDRESS_GND as part of your class or is it floating in the header file ?

            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
            • C Offline
              C Offline
              Chanchan
              wrote on last edited by
              #5

              Hey !
              It is in my public part :

              class DLTCommSetup {
              public: 
              DLTCommSetup();
              ....
              ...
              static constexpr char DEFAULT_ADDRESS_GND[13]="192.168.x.xx"
              
              
              JonBJ 1 Reply Last reply
              0
              • C Chanchan

                Hey !
                It is in my public part :

                class DLTCommSetup {
                public: 
                DLTCommSetup();
                ....
                ...
                static constexpr char DEFAULT_ADDRESS_GND[13]="192.168.x.xx"
                
                
                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #6

                @Chanchan

                I got the error : "Undefined reference to 'DLTCommSetup::DEFAULT_DLT_ADDRESS_GND' "
                static constexpr char DEFAULT_ADDRESS_GND[13]="192.168.x.xx"

                Maybe it's just me not understanding, but how is DEFAULT_ADDRESS_GND "So it is well defined here" supposed to relate to/help/avoid the undefined reference on DLTCommSetup::DEFAULT_DLT_ADDRESS_GND ?

                mrjjM 1 Reply Last reply
                2
                • JonBJ JonB

                  @Chanchan

                  I got the error : "Undefined reference to 'DLTCommSetup::DEFAULT_DLT_ADDRESS_GND' "
                  static constexpr char DEFAULT_ADDRESS_GND[13]="192.168.x.xx"

                  Maybe it's just me not understanding, but how is DEFAULT_ADDRESS_GND "So it is well defined here" supposed to relate to/help/avoid the undefined reference on DLTCommSetup::DEFAULT_DLT_ADDRESS_GND ?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @JonB
                  hehe, its more like you have a good eye :)
                  Not the same name.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Chanchan
                    wrote on last edited by
                    #8

                    Well that's the point ^^
                    I change it thank you... but still the same error (I made a copy/paste sooo we're sure it is the same name now). But the problem still here with the same error message :/ (I cleaned up the project and ran qmake before builded it again

                    JonBJ 1 Reply Last reply
                    0
                    • C Chanchan

                      Well that's the point ^^
                      I change it thank you... but still the same error (I made a copy/paste sooo we're sure it is the same name now). But the problem still here with the same error message :/ (I cleaned up the project and ran qmake before builded it again

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #9

                      @Chanchan
                      Show the relevant code and the corresponding error message as they are right now.

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Chanchan
                        wrote on last edited by
                        #10

                        It's okey, I found my problem ! I called the wrong module where my function is, that caused (I dont know why) that error
                        Qt Magic !
                        Thx for your help :)

                        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