Results 1 to 7 of 7

Thread: Undefined reference to '(class name)::connectSignSlot() in moc_(class name).o

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Undefined reference to '(class name)::connectSignSlot() in moc_(class name).o

    For the record: I'm pretty new to Qt, though I have a few c++ programming classes under my belt. My current class (c++, primarily) is the first exposure I've had to the Qt language.

    Now, I'm making a pretty complex application that is probably a little beyond what we're expected to do for our term project. I think I have everything but this one error figured out. The error, indicated in the title, seems like it requires a very advanced knowledge of the language to even know what the deuce the connectSignSlot() function is/does. The fact that it's in a ".o" file scares me. Google has zero, yes zero, results about the error message or the function (which, I'm guessing, is part of a pretty basic library that I have no business messing about with). I can only imagine that it has something to do with the guts of the language actually doing the connecting between signals and slots. The error is in a moc_(class name).o for a custom class.

    Also for the record: I was pretty careless and thrashed out a bunch of code without testing it because I was nearly certain it would work. Shame on me.

    If this error can be resolved I think the application will indeed work as intended, but I am stumped. Anyone? Let me know if you need to see some code.

    Unnecessary fluff: the application is a rudimentary character generator for D&D 3.5, only handling (all the following terms refer to their Dungeons and Dragons definitions) nonmagical core classes and core races (though I may drop the races down to a smaller selection). It will handle levels 1-20, no multiclassing, and it won't have any equipment to deal with. It will calculate BAB, saving throws, AC, initiative, abilities that don't have a numerical effect, and maybe a couple other things.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Undefined reference to '(class name)::connectSignSlot() in moc_(class name).o

    Is the header for the class "class name" included in the HEADERS varaible of the PRO file?
    Does "class name" derive from QObject and contain a Q_OBJECT macro?
    Have you rerun qmake since changing either of the items above?

  3. #3
    Join Date
    Oct 2015
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Undefined reference to '(class name)::connectSignSlot() in moc_(class name).o

    Yes to each of the second two questions. I don't have access to the code at the moment, so I'm not sure about whether or not it's included in the .pro but I'll figure that out as soon as I'm home.

  4. #4
    Join Date
    Oct 2015
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Undefined reference to '(class name)::connectSignSlot() in moc_(class name).o

    Yes to all three, and my professor has never seen that error before. I'm stumped. I did try to start a new project and add the sources and headers to it, but it produced the same error. I will try to copy/paste the contents of the sources and headers instead of bringing over the files themselves. Maybe that'll do something.

  5. #5
    Join Date
    Sep 2015
    Posts
    50
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Undefined reference to '(class name)::connectSignSlot() in moc_(class name).o

    Try to clean, run qmake, then rebuild all. If you're using the QtCreator app right-clicking the Project name in the left panel will bring up the option to execute qmake. Make sure that this is happening by checking the output of the compiler. Then rebuild.

    Assuming you ahve done this, try deleting the build directory of your project (contains your object files and intermediate build files) and then execute qmake, and rebuild. I run into this whenever I add a signal/slot combo to anything.

    If those don't do it then post your files I'll see if anything is awry.

    Cheers!
    - Caolan O'Domhnaill

Similar Threads

  1. CMake :Undefined reference for a QObject class
    By Zander87 in forum General Programming
    Replies: 2
    Last Post: 8th November 2012, 14:35
  2. undefined reference to vtable in class
    By JeanC in forum Qt Programming
    Replies: 7
    Last Post: 26th February 2011, 10:23
  3. Replies: 1
    Last Post: 5th February 2011, 03:04
  4. Replies: 3
    Last Post: 27th December 2008, 19:34
  5. Reference to a class
    By Gayathri in forum Qt Programming
    Replies: 3
    Last Post: 18th December 2006, 14:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.