473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Linker error with qt

Xx r3negade
I am new to Qt. I created a basic form with 4 buttons: btn_DoSomething, btn_Clear, btn_About, btn_Browse. I used qmake-qt4 to generate the header file containing my form info (ui_myqtapp.h).

I then created this header file:
Expand|Select|Wrap|Line Numbers
  1. // myqtapp.h:
  2.  
  3. #ifndef MYQTAPP_H
  4. #define MYQTAPP_H
  5.  
  6. #include "ui_myqtapp.h"
  7.  
  8. class myQtApp : public QWidget, private Ui::frmMain
  9. {
  10.     Q_OBJECT
  11.     public:
  12.         myQtApp(QWidget* parent = 0);
  13.     public slots:
  14.         void getPath();
  15.         void doSomething();
  16.         void clear();
  17.         void about();
  18. };
  19.  
  20. #endif
  21.  
Looks good so far, right? Then I implemented the functions defined in the slots, and connected them to the 4 buttons:
Expand|Select|Wrap|Line Numbers
  1. // myqtapp.cpp:
  2.  
  3. #include <QtGui>
  4. // if we include <QtGui> there is no need to include every class used: <QString>, <QFileDialog>,...
  5. #include "myqtapp.h"
  6.  
  7. myQtApp::myQtApp( QWidget* parent )
  8. {
  9.     setupUi(this); // Set up the GUI
  10.  
  11.     // signals / slots mechanisms in action -> link a action in the GUI to a subroutine in this class
  12.     connect( btn_Browse,    SIGNAL(clicked()),  this,   SLOT(getPath())     );
  13.     connect(btn_DoSomething,SIGNAL(clicked()),  this,   SLOT(doSomething()) );
  14.     connect( btn_Clear,     SIGNAL(clicked()),  this,   SLOT(clear())       );
  15.     connect( btn_About,     SIGNAL(clicked()),  this,   SLOT(about())       );
  16. }
  17.  
Finally, I created the "main" file:
Expand|Select|Wrap|Line Numbers
  1. // main.cpp:
  2.  
  3. #include <QApplication>
  4. #include "myqtapp.h"
  5. int main(int argc, char* argv[])
  6.  
  7. {
  8.     QApplication app(argc, argv);
  9.  
  10.     myQtApp* dialog = new myQtApp;
  11.  
  12.     dialog->show();
  13.     return app.exec();
  14. }
  15.  
It compiles fine but I get this linker error:
Expand|Select|Wrap|Line Numbers
  1. /home/jBrandt/Code/qt/myqtapp.cpp|5|undefined reference to `vtable for myQtApp'|
  2.  
in line 5 of myqtapp.cpp (myQtApp::myQtApp( QWidget* parent ))
Jun 6 '08 #1
2 2172
I know I'm not the only one here who uses Qt. I need an answer.
Jun 7 '08 #2
Banfa
9,065 Expert Mod 8TB
A quick google turned up this http://doc.trolltech.com/3.1/commonp...html#linkerror
Jun 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions...
1
by: Laszlo | last post by:
Hi all, As a novice I installed PostgreSQL 7.2.1 on Win32 and works, Borland C++Builder Enterprise Suite 5.0 (build 12.34) what works too. I decided to combine these two programs and develop a...
5
by: Pradnyesh Rane | last post by:
Hi, I am encountering the following linker error on VC7. LINK : fatal error LNK1171: unable to load ole32.dll This error is only encountered for the "Debug" configuration. The project...
3
by: Steve Baer | last post by:
I recently read your whitepaper under the "extremely long link times" post and have a question that I was hoping you could answer. My question is based on the following paragraph: Directives...
9
by: Peter Oliphant | last post by:
For some reson my code is generating a LNK1215 error, which 'suggests' I re-install VS C++. So I did. which did NOT solve the problem. The weid part is it seems to be caused by my one CPP file, but...
3
by: Chucker | last post by:
Hi Folks, I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this worked fine. When moving to .NET 2.0 I get a couple of unresolved externals / linker errors: Error 16 error...
1
by: Felix | last post by:
After porting a project from VC6 to VC.NET 2003 I have a very strange problem generating link error 1104 for import libraries. I just ported the project and made some small adaptions so it fits...
4
by: yOtA | last post by:
I get this Linker Errors while compiling my program: Error: Unresolved external 'vminit()' referenced from C:\TESTE\TESTE.OBJ Error: Unresolved external 'vmalloc(void *, int, unsigned int,...
1
by: Deepath G | last post by:
This is deepath.. I am getting some linker error when i am trying to connect Websphere MQ using Borland C++ Builder 2006 using imqi.hpp on windows. Error Message ----------------------- ...
3
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.