LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-01-2004, 07:59 AM   #1
Haiyadragon
Member
 
Registered: Sep 2003
Location: Gorredijk, Netherlands
Distribution: Arch Linux
Posts: 400

Rep: Reputation: 30
Compiling a c++ program including kmainwindow.h


Using this command:

g++ -B /usr/lib/qt3 blaat.cpp

I get:

/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTV6QGList+0xc): undefined reference to `QGList::clear()'
/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTV6QGList+0x10): undefined reference to `QGList::~QGList()'
/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTV6QGList+0x14): undefined reference to `QGList::~QGList()'
/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTV6QGList+0x18): undefined reference to `QPtrCollection::newItem(void*)'
/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTV6QGList+0x20): undefined reference to `QGList::compareItems(void*, void*)'
/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTV6QGList+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTV6QGList+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
/home/pathfinder/tmp/cc1c18ms.o(.gnu.linkonce.r._ZTI6QGList+0x8): undefined reference to `typeinfo for QPtrCollection'
collect2: ld returned 1 exit status


I don't really get in.. Can anyone help me?
 
Old 04-01-2004, 08:21 AM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
You're not linking in the necessary libraries. They look like Qt libraries to me, but I may be wrong.
 
Old 04-01-2004, 08:36 AM   #3
Haiyadragon
Member
 
Registered: Sep 2003
Location: Gorredijk, Netherlands
Distribution: Arch Linux
Posts: 400

Original Poster
Rep: Reputation: 30
If they are, what do I do?
 
Old 04-01-2004, 08:48 AM   #4
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Read up about how to compile programs for whatever system you're using. The people who write that stuff don't expect you to just know so it must be documented somewhere. pkg-config can help you if you know what libraries you're using. I mean, if you're developing for KDE or in Qt (or both) you must have some idea of what libraries you're supposed to be using?!
 
Old 04-01-2004, 09:06 AM   #5
Haiyadragon
Member
 
Registered: Sep 2003
Location: Gorredijk, Netherlands
Distribution: Arch Linux
Posts: 400

Original Poster
Rep: Reputation: 30
I'v only compiled really simple programs before.. I know where to find qlist.h (it's in /usr/lib/qt3/include). It has the functions in it the compiler is bitching about.
 
Old 04-01-2004, 09:24 AM   #6
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
It's not the header file it wants, it's the library. Usually you use something like pkg-config to fill in the bits you need.

pkg-config --cflags --libs qt-mt

does it for Qt for me, but you may need other options to get the KDE specific libs/cflags. Put the above line in backticks (below the esc key) as part of your gcc line:
Code:
gcc main.c -o main `pkg-config --cflags --libs qt-mt`

Last edited by Komakino; 04-03-2004 at 05:54 AM.
 
Old 04-01-2004, 09:46 AM   #7
Haiyadragon
Member
 
Registered: Sep 2003
Location: Gorredijk, Netherlands
Distribution: Arch Linux
Posts: 400

Original Poster
Rep: Reputation: 30
It says:

/usr/bin/ld: cannot find -l/qt-mt.pc

qt-mt.pc is located in /usr/lib/qt3/lib/pkgconfig/. Do I need to pass this directory somehow?
 
Old 04-03-2004, 05:48 AM   #8
Haiyadragon
Member
 
Registered: Sep 2003
Location: Gorredijk, Netherlands
Distribution: Arch Linux
Posts: 400

Original Poster
Rep: Reputation: 30
Anybody? Maybe suggestions on reading material..
 
Old 04-03-2004, 05:53 AM   #9
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Quote:
Originally posted by Haiyadragon
It says:

/usr/bin/ld: cannot find -l/qt-mt.pc

qt-mt.pc is located in /usr/lib/qt3/lib/pkgconfig/. Do I need to pass this directory somehow?
No, you're trying to pass qt-mt.pc to the linker...that's the file used by pkgconfig, not the linker!!!

Ok, the last example I gave you...those are NOT quote marks around pkg-config (etc) they are backticks. On a US keyboard that's the key under the escape key, to the left of the 1 key.

Find some tutorial documentation for whatever system you're using (looks like Qt with some KDE specific stuff) and find out what flags you need to pass to the compiler. www.trolltech.com has a Qt tutorial which shows you how to compile their stuff, and if you search for kde programming tutorial you'll probably find something useful. I can't give any specific references, I hated programming with Qt and it's awful 'meta object compiler'
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help compiling a program minm Linux - Newbie 3 10-10-2005 01:14 AM
Compiling a Program? dbzw Linux - Software 4 10-09-2005 01:31 PM
Compiling a program lintho Linux - Software 2 08-24-2004 07:41 AM
Compiling Program Star3132 Linux - General 8 06-29-2004 05:35 AM
compiling a program in Linux embalmedlenin Programming 4 08-29-2003 05:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration