Unresolved external symbol Qt 5
-
Hi everybody, I am a starter in Qt programming and currently following the C++ Qt programming videos on Youtube. The errors occur when I follow this video:
http://www.youtube.com/watch?v=wUH_gu2HdQE&list=SP2D1942A4688E9D63&index=5
I did exactly like in the video, but starts to get error at 6:29 when I declared "MyDialog mDialog;"
The compiler throws out these error:
@mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: virtual __thiscall MyDialog::~MyDialog(void)" (??1MyDialog@@UAE@XZ) referenced in function "private: void __thiscall MainWindow::on_actionNew_triggered(void)" (?on_actionNew_triggered@MainWindow@@AAEXXZ)@@mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: virtual __thiscall MyDialog::~MyDialog(void)" (??1MyDialog@@UAE@XZ) referenced in function "private: void __thiscall MainWindow::on_actionNew_triggered(void)" (?on_actionNew_triggered@MainWindow@@AAEXXZ)@
I have done research on the Internet and they said mostly about including headers file, but I have done all that and follow all the steps in the videos but still getting the errors.
The only difference in my program is when I added the new dialog, I couldn't rightclick on Forms but on MyWindows project folder in Projects windows.I would be greatly appreciated if you can give me any advices on this issue.
I used the lastest Qt SDK and IDE.
PS: I have tried to delete and recreate the whole new project for many times and it is still not working. -
For me, that happened when I tried to link against MSVC-compiled Qt libraries using MinGW toolchain by mistake.
I would check the toolkit twice to avoid such errors.
-
Thanks very much for your reply!
But would you please show me how can I check that error? -
I have "accidentally" solved the problem.
I rightclicked on the project folder in the Project windows and choose qmake. After that, choose Run and all the errors disappeared.
I don't know why that works by the way. -
In Qt creator go to Tools => Options => Build and run then see Qt versions and Tool Chains tabs. There should be a list of your installed Qt libraries and available toolchains.
-
@qt_newbie89
I'd the same error just like you :( I coudn't build my application, it was very difficalt to find a solution of this probleme.
So I used your solution and it works very well with me, and now i can build my application ;)
Thank you very much. -
(Using Qt creator 3.0.0 Based on Qt 5.2.0) I to could not right click on Forms and had to add the header file through the File tab, then New File or Project. However I don't have the .cpp or .ui file. Did you guys manually add these as well? As for soroush's response on Tool Chains and Libraries I don't have anything to add in that tab so is there anything you can recommend I download in order to add to that tab to fix this problem?
-Thanks in advance for any help I may receive
-
I had the same problem over & over in Qt-Win. As qt_newbie89 mentioned; if you right-click on your project (visible in the topleft-sidebar containing all your header, sources, ui & .pro), you can choose 'Run qmake'. Build your project and the project builded without errors! Thnx qt-newbie89!
-
It seems my problem laid in a more simple area at time 4:08 in the video https://www.youtube.com/watch?v=wUH_gu2HdQE I was unable to right click on Forms (Using Qt creator 3.0.0 Based on Qt 5.2.0) and I found the simple solution of right clicking on the folder containing the .pro (project) instead.