Skip to main content

How to fix Qt Error when adding new form

I was trying to add new form UI class form to the Qt and since I'm a newbie ( actually started today) with C++ Qt framwork at this time i got stuck when I tried to add Push button to open new Class Form. it showed this damn error several times.

mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl DialogDemo::DialogDemo(class QWidget *)" (??0DialogDemo@@QEAA@PEAVQWidget@@@Z) referenced in function "private: void __cdecl MainWindow::on_btn_cancel_clicked(void)" (?on_btn_cancel_clicked@MainWindow@@AEAAXXZ)
Rebuilding and cleaning the project not worked since I've tried several ways to display that new GUI form.

Solution was simple here i quote stackoverflow answer.

Solution

  1. Right click on project > Clean
  2. Right click on project > Run qmake
  3. Right click on project > Build
  4. Run - worked first time

Why it works

The reason this worked is because Run qmake updates your Makefile. For some reason qt is not automatically updating paths when you make changes to your project such as adding or removing files. Running qmake forces qt to update the paths for your project which enables it to find the mainwindow.obj file. You probably could just run qmake and your problem would be solved.


Comments

Popular posts from this blog

Foxeprenuer at UCSC | Introduction to Firefox Student Ambassadors

Had privilege to attend another awesome event as Regional Ambassador Lead . "Foxepernuer 2016" organized by University of Colombo , School of Computing , UCSC Firefox Club - Sri Lanka . Introduction FSA Program - Sri Lanka  while I had chance to talk about Mozilla project , Firefox Student Ambassador program , contributions and benefits , had opportunity to meet great enthusiast people after the event.  And Future of developments & technologies , being a professional & maintain it Encouraging students bring innovative ideas happen , becoming entrepreneurs and really interesting topics we discussed by resource persons.   Shafraz Rahim and Malinda Prasad from Dialog Axiata IdeaMart , and Rashmika Nawaratne from 99X Techno logy has done those sessions in really interesting way !.  Rashmika Navaratne talk about maintain professionalism Shafraz Rahim on "Intern Entrepreneur" Malinda Prasad talk about "...

Contributing with Isuru Linux program

Lately Ministry of Education ICT Unit ,powered up their Project call Isuru Linux.Well it was project with long history but as far as I know this is the time came with public awareness , events,  workshops  etc. Thanks to Mr Saman I got this chance with work with them and it was a great experience for my community projects including advocating and learning about  FOSS .   * This post will be updated with more details පාසල් සිසුන්ගේ නිදහස් මාදුකාංග පිළිබඳව දැනුම වර්ධනය කිරීම සඳහා අවස්ථාව සැලසීම අරමුණු කර ගනිමින් අධ්‍යාපන අමාත්‍යංශයේ තොර... Posted by ISURU Linux ඉසුරු ලිනක්ස් on  Friday, January 29, 2016