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. Unresolved external symbol calling some simple constructive code inside of a slot generated by designer.
Qt 6.11 is out! See what's new in the release blog

Unresolved external symbol calling some simple constructive code inside of a slot generated by designer.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 669 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.
  • enjoysmathE Offline
    enjoysmathE Offline
    enjoysmath
    wrote on last edited by enjoysmath
    #1
    void MainWindow::on_actionNew_triggered()
    {
        auto tab_name = QString("New_blank");
        auto editor = new Editor(tab_name);
        addEditor(editor);
    }
    

    Thats the slot, the protototype was generated by "go to slot" from designer.

    However it always results in:

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl Editor::Editor(class QString &)" (??0Editor@@QEAA@AEAVQString@@@Z) referenced in function "private: void __cdecl MainWindow::on_actionNew_triggered(void)" (?on_actionNew_triggered@MainWindow@@AEAAXXZ)
    

    Which makes no sense to me at all because I'm that new. So what do I need to indicate in order to actually do something in the slot?


    Things I've tried:

    • Wrapping the code in a void function in MainWindow. Now the call to that is unresolved... seems I can't do anything in the slot.
    • Switching to release - it builds. But I need to debug!
    • Changing the order of the source files in the .pro make file. no difference.

    It says in red next to the error "File not found: mainwindow.obj" but I checked in the debug directory and they're there. editor.obj is not there however, it is in the .pro makefile, so Idk what's going on...

    https://github.com/enjoysmath
    https://math.stackexchange.com/users/26327/exercisingmathematician

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

      Hi
      It says
      I cannot find
      public: __cdecl Editor::Editor(class QString &)

      where u use it in on_actionNew_triggered

      so is the constructor like that ?
      in your other post it was
      Editor(QString& name, QMainWindow* window);

      so it should be like
      auto editor = new Editor(tab_name, this);

      if its still like that.

      1 Reply Last reply
      2
      • enjoysmathE Offline
        enjoysmathE Offline
        enjoysmath
        wrote on last edited by
        #3

        Re: Unresolved external symbol calling some simple constructive code inside of a slot generated by designer.

        Yes, I have that correct. But error persists

        https://github.com/enjoysmath
        https://math.stackexchange.com/users/26327/exercisingmathematician

        mrjjM 1 Reply Last reply
        0
        • enjoysmathE enjoysmath

          Re: Unresolved external symbol calling some simple constructive code inside of a slot generated by designer.

          Yes, I have that correct. But error persists

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

          @enjoysmath
          Try Clean and then Rebuild all.

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

            Hi,

            Silly question but did you implement that constructor ?

            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
            1

            • Login

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