From: Alex Morgan Newsgroups: comp.os.msdos.djgpp Subject: Re: problem: undefined reference Date: Thu, 03 Jun 1999 17:20:43 -0400 Organization: Emory University Lines: 72 Message-ID: <3756F1AB.B68C62A6@emory.edu> References: <3755E159 DOT 30225169 AT emory DOT edu> NNTP-Posting-Host: anx55-2.dialup.emory.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: lendl.cc.emory.edu 928444964 21456 170.140.251.2 (3 Jun 1999 21:22:44 GMT) X-Complaints-To: abuse AT emory DOT edu NNTP-Posting-Date: 3 Jun 1999 21:22:44 GMT X-Mailer: Mozilla 4.5 [en] (Win98; I) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi all! I found--and fixed--the problem. It seems that I forgot to compile and include simpio.o in my library. No wonder it choked. Classic programmer mistake #46. Oh well. Thanks. Alex Alex Morgan wrote: > Hi all. > > I'm new to djgpp and I'm still trying to get the hang of it. I have > read the FAQ and looked through the archives (I saw that there are lots > of people who have received a similar message), but I can't figure out > what to do. > > I have a program that calls a command that resides in a library (named > libcs.a) that I made that resides in the c:\djgpp\lib directory (I also > have a copy of it in my pwd). The program (see below) compiles fine, > but when gcc tries to link all of the files, I get this: > > C:\djgpp\sources\02>gcc -v greeting.o -lcs -o greeting.exe > Reading specs from c:/djgpp/lib/specs > gcc version 2.8.1 > c:/djgpp/bin/ld.exe -o greeting.exe c:/djgpp/lib/crt0.o -Lc:/djgpp/lib > -Lc:/djg > pp/contrib/grx22/lib -Lc:/djgpp/cslib/windows > -Lc:/djgpp/lib/gcc-lib/djgpp/2.81 > -Lc:/djgpp/bin -Lc:/djgpp/lib greeting.o -lcs -Tdjgpp.djl -lgcc -lc > -lgcc > greeting.o(.text+0x34):greeting.c: undefined reference to `GetLine' > > The program, greeting.c, is as follows: > > C:\Dev-C++\sources\02>type greeting.c > /* > * File: greeting.c > * ---------------- > * This program prints a more personal greeting than did > * the original "Hello, world." program by reading in the > * name of the user. > */ > > #include > #include "genlib.h" > #include "simpio.h" > > main() > { > string user; > > printf("What is your name? "); > user = GetLine(); > printf("Hello, %s.\n", user); > } > > Both "genlib.h" and "simpio.h" reside in c:\djgpp\include and the pwd ( > I believe that djgpp should search my pwd for the "*.h" files, but I > wanted to be sure they were found.) > > I could post the contents of both genlib.* and simpio.* if necessary. > BTW, I did not write these files; they came as part of a package for a > class that I'm taking. > > Any suggestions on how to resolve this? > > Alex