LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 06-14-2005, 02:07 AM   #1
back2morrie
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, 08:02 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

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


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


All times are GMT -5. The time now is 10:45 AM.

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