Find the answer to your Linux question:
Results 1 to 3 of 3
hi ! i wrote a little program and i have problems to compile it. i have gentoo with qt 3.3 installed. here are the two source codes and what i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie robak's Avatar
    Join Date
    Jan 2004
    Posts
    136

    problems with qt


    hi !

    i wrote a little program and i have problems to compile it.
    i have gentoo with qt 3.3 installed.
    here are the two source codes and what i did to compile

    qt-hello.h
    Code:
    #ifndef QT_HELLO_H
    #include <qvbox.h>
    #include <qlineedit.h>
    #include <qlabel.h>
    #include <qpushbutton.h>
    
    class myfirst&#58;public QVBox
    &#123;
    	Q_OBJECT
    	public&#58;
    	myfirst&#40;&#41;;
    	private&#58;
    	QLabel *hi_label;
    	QLineEdit *hi_edit;
    	QPushButton *hi_pb;
    	private slots&#58;
    	void sayHello&#40;&#41;;
    &#125;;
    #define QT_HELLO_H
    #endif
    qt-hello.cc
    Code:
    #include <qapplication.h>
    #include <qmessagebox.h>
    #include "qt-hello.h"
    
    myfirst&#58;&#58;myfirst&#40;&#41;
    &#123;
    	hi_label=new QLabel&#40;"Ihr Name&#58; ", this&#41;;
    	hi_edit=new QLineEdit&#40;this&#41;;
    	hi_pb=new QPushButton&#40;"Sag Hallo", this&#41;;
    	connect&#40;hi_pb, SIGNAL&#40;clicked&#40;&#41;&#41;, this, SLOT&#40;sayHello&#40;&#41;&#41;&#41;;
    &#125;;
    
    void myfirst&#58;&#58;sayHello&#40;&#41;
    &#123;
    	QMessageBox *hi=new QMessageBox&#40;
    					"Hallo!",
    					"Sei gegruest, " +hi_edit->text&#40;&#41;,
    					QMessageBox&#58;&#58;Information,
    					QMessageBox&#58;&#58;Ok,
    					QMessageBox&#58;&#58;NoButton,
    					QMessageBox&#58;&#58;NoButton
    					&#41;;
    	hi->exec&#40;&#41;;
    	delete hi;
    &#125;
    
    int main&#40;int argc, char *argv&#91;&#93;&#41;
    &#123;
    	QApplication a&#40;argc, argv&#41;;
    	myfirst mf;
    	a.setMainWidget&#40;&mf&#41;;
    	mf.setCaption&#40;"Hallo Welt"&#41;;
    	mf.show&#40;&#41;;
    	return a.exec&#40;&#41;;
    &#125;
    what i did to compile
    Code:
    nurbs@lora qt $ ls
          qt-hello.cc  qt-hello.h
    nurbs@lora qt $ qmake -project
    nurbs@lora qt $ qmake
    nurbs@lora qt $ ls
          Makefile  qt-hello.cc  qt-hello.h  qt.pro
    nurbs@lora qt $ make
    g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG  -I/usr/qt/3/mkspecs/linux-g++ -I. -I. -I/usr/qt/3//include -o qt-hello.o qt-hello.cc
    /usr/qt/3//bin/moc qt-hello.h -o moc_qt-hello.cpp
    g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG  -I/usr/qt/3/mkspecs/linux-g++ -I. -I. -I/usr/qt/3//include -o moc_qt-hello.o moc_qt-hello.cpp
    g++  -o qt qt-hello.o moc_qt-hello.o   -L/usr/X11R6/lib -lXext -lX11 -lm
    qt-hello.o&#40;.text+0x28&#41;&#58; In function `myfirst&#58;&#58;myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QVBox&#58;&#58;QVBox&#40;QWidget*, char const*, unsigned int&#41;'
    qt-hello.o&#40;.text+0x5b&#41;&#58; In function `myfirst&#58;&#58;myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QString&#58;&#58;QString&#40;char const*&#41;'
    qt-hello.o&#40;.text+0x77&#41;&#58; In function `myfirst&#58;&#58;myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QLabel&#58;&#58;QLabel&#40;QString const&, QWidget*, char const*, unsigned int&#41;'
    qt-hello.o&#40;.text+0x93&#41;&#58; In function `myfirst&#58;&#58;myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QString&#58;&#58;shared_null'
    qt-hello.o&#40;.text+0x9d&#41;&#58; In function `myfirst&#58;&#58;myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QStringData&#58;&#58;deleteSelf&#40;&#41;'
    qt-hello.o&#40;.text+0xbd&#41;&#58; In function `myfirst&#58;&#58;myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QLineEdit&#58;&#58;QLineEdit&#40;QWidget*, char const*&#41;'
     
    .
    .
    .
    
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1c4&#41;&#58; undefined reference to `QFrame&#58;&#58;setLineWidth&#40;int&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1c8&#41;&#58; undefined reference to `QFrame&#58;&#58;setMargin&#40;int&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1cc&#41;&#58; undefined reference to `QFrame&#58;&#58;setMidLineWidth&#40;int&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1d0&#41;&#58; undefined reference to `QFrame&#58;&#58;setFrameRect&#40;QRect const&&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1d4&#41;&#58; undefined reference to `QFrame&#58;&#58;drawFrame&#40;QPainter*&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1d8&#41;&#58; undefined reference to `QFrame&#58;&#58;drawContents&#40;QPainter*&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1dc&#41;&#58; undefined reference to `QHBox&#58;&#58;frameChanged&#40;&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1f0&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;setResolution&#40;int&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1f4&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;resolution&#40;&#41; const'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1f8&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;handle&#40;&#41; const'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x1fc&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;x11RenderHandle&#40;&#41; const'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x200&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;setX11Data&#40;QPaintDeviceX11Data const*&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x204&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;cmd&#40;int, QPainter*, QPDevCmdParam*&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x208&#41;&#58; undefined reference to `non-virtual thunk to QWidget&#58;&#58;metric&#40;int&#41; const'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x20c&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;fontMet&#40;QFont*, int, char const*,int&#41; const'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTV7myfirst+0x210&#41;&#58; undefined reference to `QPaintDevice&#58;&#58;fontInf&#40;QFont*, int&#41; const'
    moc_qt-hello.o&#40;.gnu.linkonce.t._ZN7myfirstD1Ev+0xb&#41;&#58; In function `myfirst&#58;&#58;~myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `vtable for QFrame'
    moc_qt-hello.o&#40;.gnu.linkonce.t._ZN7myfirstD1Ev+0x12&#41;&#58; In function `myfirst&#58;&#58;~myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `vtable for QFrame'
    moc_qt-hello.o&#40;.gnu.linkonce.t._ZN7myfirstD1Ev+0x1a&#41;&#58; In function `myfirst&#58;&#58;~myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QWidget&#58;&#58;~QWidget&#40;&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.t._ZN7myfirstD0Ev+0xe&#41;&#58; In function `myfirst&#58;&#58;~myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `vtable for QFrame'
    moc_qt-hello.o&#40;.gnu.linkonce.t._ZN7myfirstD0Ev+0x15&#41;&#58; In function `myfirst&#58;&#58;~myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `vtable for QFrame'
    moc_qt-hello.o&#40;.gnu.linkonce.t._ZN7myfirstD0Ev+0x1d&#41;&#58; In function `myfirst&#58;&#58;~myfirst&#40;&#41;'&#58;
    &#58; undefined reference to `QWidget&#58;&#58;~QWidget&#40;&#41;'
    moc_qt-hello.o&#40;.gnu.linkonce.r._ZTI7myfirst+0x8&#41;&#58; undefined reference to `typeinfo for QVBox'
    collect2&#58; ld returned 1 exit status
    make&#58; *** &#91;qt&#93; Error 1
    nurbs@lora qt $
    can somebody help me please?

    thanks in advance
    greez robak
    make install not love

    Registered Linux user number 369245

  2. #2
    Linux Newbie robak's Avatar
    Join Date
    Jan 2004
    Posts
    136
    i solved the problem even if there wasn't one.
    i just changed some lines, and then changed them back so that everything stayed the unchanged.
    now its working
    make install not love

    Registered Linux user number 369245

  3. #3
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    Odd...but cool that it works now.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •