LinuxQuestions.org
Help answer threads with 0 replies.
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 11-06-2004, 10:45 PM   #1
QtCoder
Member
 
Registered: Aug 2003
Location: USA
Distribution: Slackware 12.0 RC1
Posts: 129

Rep: Reputation: 15
Qt 3.3.3 undefined references when linking Ch. 7 tutorial


I'm trying to compile and link the Tutorial 1, Chapter 7 tutorial from Qt Assistant 3.3.3, but whenever I run make, I get this:

Code:
root@localhost:~/Programs/main# ls
Makefile  lcdrange.h  main.cpp  main.o  main.pro  moc_lcdrange.cpp  moc_lcdrange.o
root@localhost:~/Programs/main# make
g++ -Wl,-rpath,/usr/lib/qt/lib -o main main.o moc_lcdrange.o   -L/usr/lib/qt/lib -L/usr/X11R6/lib 
-lqt-mt -lXext -lX11 -lm
main.o(.text+0x142): In function `MyWidget::MyWidget[not-in-charge](QWidget*, char const*)':
: undefined reference to `LCDRange::LCDRange[in-charge](QWidget*, char const*)'
main.o(.text+0x381): In function `MyWidget::MyWidget[in-charge](QWidget*, char const*)':
: undefined reference to `LCDRange::LCDRange[in-charge](QWidget*, char const*)'
moc_lcdrange.o(.text+0x1f9): In function `LCDRange::qt_invoke(int, QUObject*)':
: undefined reference to `LCDRange::setValue(int)'
collect2: ld returned 1 exit status
make: *** [main] Error 1
Obviously, it can't find anything dealing with LCDRange....

I've been doing a lot of googling but I cannot find anything that fits this description.

I'm running Slackware 10, KDE 3.3.1, with Qt 3.3.3. I first thought that I typed something in wrong, but when I copied and pasted the tutorial code directly from Qt Assistant, the same problem occurred. I am following the usual steps: qmake -project, qmake, make. I've tried adding 'config += thread' to the project file. Nothing has worked yet. I cannot figure this one out.

The previous tutorials compiled and linked just fine. Only when I got into creating my own widgets with signals and slots did the problem occur.
 
Old 11-07-2004, 12:15 AM   #2
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Rep: Reputation: 121Reputation: 121
This sounds silly but have you tried compiling in KDevelop?

Also have you given the libraries that you linked with in the path? This error seems like a linker error, not a compiler error.
 
Old 11-07-2004, 11:53 AM   #3
QtCoder
Member
 
Registered: Aug 2003
Location: USA
Distribution: Slackware 12.0 RC1
Posts: 129

Original Poster
Rep: Reputation: 15
Okay, this is weird. I opened the project in KDevelop, saved it, and ran make again, and all went well....
I'm going to try another project without KDevelop again, and watch what happens.

And yes, I have the libraries listed in my path. I have also got the $QTDIR env variable set up correctly. For some reason, my lcdrange.o seemed to fall off into the abyss when I went to compile/link. I'll watch closely this time and see what happens.
 
Old 11-07-2004, 11:59 AM   #4
QtCoder
Member
 
Registered: Aug 2003
Location: USA
Distribution: Slackware 12.0 RC1
Posts: 129

Original Poster
Rep: Reputation: 15
Again, everything worked. Perhaps when I edited lcdrange.cpp in gedit, I didn't save it. Perhaps I accidentally deleted it (or its object file). I'll just have to watch myself from now on. A little absend-mindedness can cause a lot or problems, lol.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Undefined references with static libraries Nightfox Programming 2 10-28-2005 06:43 PM
gcc linking: undefined reference to just about everything shabbychef Programming 7 09-09-2005 08:42 PM
texinfo - undefined references during make fitret Linux - Software 1 06-18-2005 02:38 PM
Undefined references when linkin against Debian packaged libs stackoverflow32 Programming 3 08-08-2004 02:09 PM
why compiler gives undefined references on static members??? Hano Programming 8 06-26-2002 11:12 AM


All times are GMT -5. The time now is 10:50 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration