Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop drive driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network printer problem ram random registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Undefined reference to "function name"

Reply  
Thread Tools
tkh's Avatar
tkh tkh is offline
Member with 132 posts.
 
Join Date: Jan 2004
27-Sep-2006, 09:05 AM #1
Undefined reference to "function name"
Hi guys,

I am currently using Linux trying to compile a C program but it keeps returning an "Undefined reference to <functionName>".. generally what is the source of problem? I tried adding in the relevant libraries but to no avail.

Thanks
Chicon's Avatar
Computer Specs
Distinguished Member with 6,690 posts.
 
Join Date: Jul 2004
Location: 50° 34' 07.13" N - 04° 10' 23.
Experience: Second socks retriever
27-Sep-2006, 09:58 AM #2
Hi tkh,

The probleme may occur when the library (a file with the .h extension) in which the function is defined is missing or mislocated.
You should check the library path used for the pre-compiler.
Otherwise, you have to check your coding, C language is case sensitive.
AGCurry's Avatar
Senior Member with 431 posts.
 
Join Date: Jun 2005
Location: Kansas City area
Experience: advanced but learning
27-Sep-2006, 04:39 PM #3
Quote:
Originally Posted by Chicon
Hi tkh,

The probleme may occur when the library (a file with the .h extension) in which the function is defined is missing or mislocated.
You should check the library path used for the pre-compiler.
Otherwise, you have to check your coding, C language is case sensitive.
This is a common confusion in C programming.

The library is NOT the same as the header (.h) file. C libraries are collections of compiled objects which are LINKED to your object code by the linker. Header files are lexically included by the preprocessor.

When you compile, you need to make sure that the libraries are where they're supposed to be AND the header files (INCLUDE=...) are where they're supposed to be. Either one can mess you up.
Chicon's Avatar
Computer Specs
Distinguished Member with 6,690 posts.
 
Join Date: Jul 2004
Location: 50° 34' 07.13" N - 04° 10' 23.
Experience: Second socks retriever
27-Sep-2006, 05:49 PM #4
Quote:
Originally Posted by AGCurry
This is a common confusion in C programming.

The library is NOT the same as the header (.h) file. C libraries are collections of compiled objects which are LINKED to your object code by the linker. Header files are lexically included by the preprocessor.

When you compile, you need to make sure that the libraries are where they're supposed to be AND the header files (INCLUDE=...) are where they're supposed to be. Either one can mess you up.
Thanks for refreshing my memory, AGC !
blaqDeaph's Avatar
Senior Member with 881 posts.
 
Join Date: Nov 2005
Location: Down Under!
Experience: Enough
29-Sep-2006, 10:30 PM #5
Quote:
Originally Posted by AGCurry
This is a common confusion in C programming.

The library is NOT the same as the header (.h) file. C libraries are collections of compiled objects which are LINKED to your object code by the linker. Header files are lexically included by the preprocessor.

When you compile, you need to make sure that the libraries are where they're supposed to be AND the header files (INCLUDE=...) are where they're supposed to be. Either one can mess you up.
Thats just the tip of the iceberg, because header files can contain refrences to multiple libraries, by including other header files in it. A good example is the windows.h header, which actually includes other header files like winuser.h

Trying to find out what library you need can be a mess, your best bet is to download the full Development kit that contains all the headers/libraries. Otherwise it's like finding a needle in the haystack.
__________________
Windows XP: 64-bit wanna-be OS with a 32-bit graphical shell for 16-bit extensions of a 8-bit patch to an 4-bit operating system originally coded for a 2-bit microprocessor, written by a company that can't stand 1 bit of competition.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:32 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.