Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 06-14-2005, 03:07 AM   #1
LQ Newbie
Registered: May 2005
Posts: 7

Rep: Reputation: 0
linking problems - 'undefined reference' errors

i am using DJGPP cross-compiler to compile and run C/C++ files in windows on a linux platform. However it is showing 'undefined reference' errors for some library functions(user-defined), contained in a file called 'libgmlib.a' - i dont have the C source for those functions and so cannot rebuild the library. A file called 'gmlib.h' has the declarations for these functions.

i tried giving both the path of the lib directory (-L<pathname>) as well as
'-lgmlib' in the command line. but the same errors still appear.

It compiles upto the object files(using -c option) and has problems only while linking.

I dont understand why it cant read the library - it appears so simple!

I have successfully compiled and run simple c++ programs using the DJGPP - so i guess the problem is not with the compiler.
Old 06-14-2005, 09:02 AM   #2
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
Try: gcc yourprog.c libgmlib.a -o yourprog.exe


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
gcc linking: undefined reference to just about everything shabbychef Programming 7 09-09-2005 09:42 PM
g++: inline functions can cause an undefined reference when linking? R00ts Programming 5 06-21-2005 04:13 AM
Linking own library: undefined reference to otosigo Programming 1 12-02-2004 09:05 AM
Undefined Reference errors during make. sheenak Programming 5 05-14-2004 07:14 AM
G++ Linking Error "undefined reference" djjumper9 Programming 2 04-13-2004 10:36 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:21 PM.

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