LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-24-2005, 04:44 AM   #1
jackandking
Member
 
Registered: Dec 2004
Posts: 92

Rep: Reputation: 15
what's the difference between symbol and reference?


when compiling c/c++ sources, I always get such error:
... undefined symbol
or
...undefined reference

what's their difference?
how to deal with such errors ?
 
Old 01-24-2005, 11:24 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
I'm not sure where you're getting the undefined symbol error, but you'll get an undefined reference error if you call a function that doesn't exist.
Code:
itsme@dreams:~/C$ cat bad.c
int main(void)
{
  foo();

  return 0;
}
itsme@dreams:~/C$ gcc -Wall bad.c -o bad
bad.c: In function `main':
bad.c:3: warning: implicit declaration of function `foo'
/tmp/ccGWEcsx.o: In function `main':
/tmp/ccGWEcsx.o(.text+0x7): undefined reference to `foo'
collect2: ld returned 1 exit status
itsme@dreams:~/C$
 
  


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
I can't get this | symbol Plitter Linux - Newbie 14 11-09-2005 04:15 PM
snort failed: snort: symbol lookup error: undefined symbol: usmAES192PrivProtocol Emmanuel_uk Linux - Security 1 07-10-2005 10:29 AM
need some reference Hamid Moradmand Programming 0 05-17-2004 12:46 AM
C++ Reference qcoder Programming 6 01-13-2004 02:22 AM
Glib-1.020 install problem Can't use an undefined value as a symbol reference jimdaworm Linux - Software 1 01-03-2004 05:32 AM

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

All times are GMT -5. The time now is 01:32 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