Newbie - Linking error

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Hello Friends,

I am facing problem in compiling simple program in Qtopia.

I had downloaded qtopia-free-1.7.0-1rh9.i386.rpm. Using alien utility,
I had converted rpm to deb. ( I am  working on debian distribution of
Linux ) I had installed it.

After installation, I found that it's created a directory in 'opt'

I had exported variables :

export QPEDIR=/opt/Qtopia
export QTDIR=/opt/Qtopia
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

When I had started,

qvfb &
qpe &

It's working fine.

Now, I had started developing,

I had created one application named hello.cpp

#include <qpe/qpeapplication.h>
#include <qpushbutton.h>

int main( int argc, char **argv )
{
        QPEApplication a( argc, argv );
        QPushButton hello( "Hello world!", 0 ); hello.resize( 100, 30
);
        a.setMainWidget( &hello );
        hello.show();
        return a.exec();
}

Compile :

 g++ -c -L$QTDIR/lib -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W
-O2 -fno-default-inline -DNO_DEBUG -I$OPIEDIR/include -I$QTDIR/include
-o hello.o hello.cpp

Completed Successfully.
Linking :

g++ -o hello hello.o -L$QTDIR/lib -lqpe -lqt

It's giving following errors :

hello.o(.text+0x1a): In function `main':
: undefined reference to `QPEApplication::QPEApplication(int &, char
**, QApplication::Type)'
hello.o(.text+0x2e): In function `main':
: undefined reference to `QString::QString(char const *)'
hello.o(.text+0x3f): In function `main':
: undefined reference to `QPushButton::QPushButton(QString const &,
QWidget *, char const *)'
hello.o(.text+0x65): In function `main':
: undefined reference to `QString::shared_null'
hello.o(.text+0x6d): In function `main':
: undefined reference to `QString::shared_null'
hello.o(.text+0x7a): In function `main':
: undefined reference to `QStringData::deleteSelf(void)'
hello.o(.text+0x8a): In function `main':
: undefined reference to `QPushButton::resize(int, int)'
hello.o(.text+0x94): In function `main':
: undefined reference to `QApplication::setMainWidget(QWidget *)'
hello.o(.text+0xa0): In function `main':
: undefined reference to `QWidget::show(void)'
hello.o(.text+0xa9): In function `main':
: undefined reference to `QPEApplication::exec(void)'
hello.o(.text+0xb6): In function `main':
: undefined reference to `QPushButton::~QPushButton(void)'
hello.o(.text+0xc1): In function `main':
: undefined reference to `QPEApplication::~QPEApplication(void)'
hello.o(.QArray<char>::gnu.linkonce.t.(void)+0xf): In function
`QArray<char>::QArray(void)':
: undefined reference to `QGArray::QGArray(void)'
hello.o(.gnu.linkonce.t._._t6QArray1Zc+0x19): In function
`QArray<char>::~QArray(void)':
: undefined reference to `QGArray::~QGArray(void)'
hello.o(.QArray<char>::gnu.linkonce.t.(QArray<char> const &)+0x12): In
function `QArray<char>::QArray(QArray<char> const &)':
: undefined reference to `QGArray::QGArray(QGArray const &)'
hello.o(.QArray<char>::gnu.linkonce.t.assign(QArray<char> const
&)+0x10): In function `QArray<char>::assign(QArray<char> const &)':
: undefined reference to `QGArray::assign(QGArray const &)'
hello.o(.QArray<char>::gnu.linkonce.t.duplicate(char const *, unsigned
int)+0x13): In function `QArray<char>::duplicate(char const *,
unsigned int)':
: undefined reference to `QGArray::duplicate(char const *, unsigned
int)'
hello.o(.QArray<char>::gnu.linkonce.t.data(void) const+0xd): In
function `QArray<char>::data(void) const':
: undefined reference to `QGArray::data(void) const'
hello.o(.QValueListNode<QString>::gnu.linkonce.t.(void)+0xb): In
function `QValueListNode<QString>::QValueListNode(void)':
: undefined reference to `QString::shared_null'
hello.o(.QValueListNode<QString>::gnu.linkonce.t.(void)+0x14): In
function `QValueListNode<QString>::QValueListNode(void)':
: undefined reference to `QString::makeSharedNull(void)'
hello.o(.gnu.linkonce.t._._t17QValueListPrivate1Z7QString+0x32): In
function `QValueListPrivate<QString>::~QValueListPrivate(void)':
: undefined reference to `QString::shared_null'
hello.o(.gnu.linkonce.t._._t17QValueListPrivate1Z7QString+0x3a): In
function `QValueListPrivate<QString>::~QValueListPrivate(void)':
: undefined reference to `QString::shared_null'
hello.o(.gnu.linkonce.t._._t17QValueListPrivate1Z7QString+0x47): In
function `QValueListPrivate<QString>::~QValueListPrivate(void)':
: undefined reference to `QStringData::deleteSelf(void)'
hello.o(.gnu.linkonce.t._._t17QValueListPrivate1Z7QString+0x7f): In
function `QValueListPrivate<QString>::~QValueListPrivate(void)':
: undefined reference to `QString::shared_null'
hello.o(.gnu.linkonce.t._._t17QValueListPrivate1Z7QString+0x87): In
function `QValueListPrivate<QString>::~QValueListPrivate(void)':
: undefined reference to `QString::shared_null'
hello.o(.gnu.linkonce.t._._t17QValueListPrivate1Z7QString+0x94): In
function `QValueListPrivate<QString>::~QValueListPrivate(void)':
: undefined reference to `QStringData::deleteSelf(void)'
hello.o(.QValueListNode<QString>::gnu.linkonce.t.(QString const
&)+0x15): In function `QValueListNode<QString>::QValueListNode(QString
const &)':
: undefined reference to `QString::QString(QString const &)'
hello.o(.QList<char>::gnu.linkonce.t.(void)+0xf): In function
`QList<char>::QList(void)':
: undefined reference to `QGList::QGList(void)'
hello.o(.QList<char>::gnu.linkonce.t.clear(void)+0xd): In function
`QList<char>::clear(void)':
: undefined reference to `QGList::clear(void)'
hello.o(.gnu.linkonce.t._._t5QList1Zc+0x27): In function
`QList<char>::~QList(void)':
: undefined reference to `QGList::~QGList(void)'
hello.o(.gnu.linkonce.t.__as__t5QList1ZcRCt5QList1Zc+0x10): In
function `QList<char>::operator=(QList<char> const &)':
: undefined reference to `QGList::operator=(QGList const &)'
hello.o(.QList<char>::gnu.linkonce.t.(QList<char> const &)+0x12): In
function `QList<char>::QList(QList<char> const &)':
: undefined reference to `QGList::QGList(QGList const &)'
hello.o(.gnu.linkonce.d.__vt_t5QList1Zc+0x14): undefined reference to
`QCollection::newItem(void *)'
hello.o(.gnu.linkonce.d.__vt_t5QList1Zc+0x1c): undefined reference to
`QGList::compareItems(void *, void *)'
hello.o(.gnu.linkonce.d.__vt_t5QList1Zc+0x20): undefined reference to
`QGList::read(QDataStream &, void *&)'
hello.o(.gnu.linkonce.d.__vt_t5QList1Zc+0x24): undefined reference to
`QGList::write(QDataStream &, void *) const'
hello.o(.QArray<char>::gnu.linkonce.t.detach(void)+0xd): In function
`QArray<char>::detach(void)':
: undefined reference to `QGArray::detach(void)'
hello.o(.gnu.linkonce.d.__vt_t6QArray1Zc+0x10): undefined reference to
`QGArray::newData(void)'
hello.o(.gnu.linkonce.d.__vt_t6QArray1Zc+0x14): undefined reference to
`QGArray::deleteData(QGArray::array_data *)'
/opt/Qtopia/lib/libqte.so: undefined reference to
`QWizard::staticMetaObject()'
collect2: ld returned 1 exit status

Can you tell me what is error ?

Site Timeline