delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/23/01:01:41

From: <kvogt AT UVic DOT CA>
Newsgroups: comp.os.msdos.djgpp
Subject: gcc 'undefined reference' error
Date: Wed, 22 Aug 2001 21:59:07 -0700
Organization: University of Victoria
Lines: 34
Message-ID: <Pine.A41.4.32.0108222140240.126880-100000@unix5.uvic.ca>
NNTP-Posting-Host: unix5.uvic.ca
Mime-Version: 1.0
X-Trace: casper.uvic.ca 998542764 39500 142.104.5.117 (23 Aug 2001 04:59:24 GMT)
X-Complaints-To: abuse AT uvic DOT ca
NNTP-Posting-Date: Thu, 23 Aug 2001 04:59:24 +0000 (UTC)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello,

I am getting 'undefined reference' link errors, and I do not know why.

Sample code:
#include <stdio.h>
#include <pc.h>
int main( void )
{
   ScreenMode(); // declared in pc.h, defined in pc.c
   return 1;
}

gcc command:
gcc -o test.exe test.c -lpc

error:
c:/djgpp/tmp\ccFN3J0x.o(.text+0x78):test.c: undefined reference to
"ScreenMode"

I get the error with other functions within pc.h, and also with other
functions from other libraries. I checked that libpc.a is in my 'lib'
directory. As far as I know, I am using the proper versions for
everything. I used the -v option for gcc to check if the RSXNTDJ
directories were being searched before the DJGPP dirs, but that is not
happening.

The linker has no trouble finding pc.h, but why does it not
recognize the functions within?

I would appreciate any help on this. Thanks :0)

Kevin

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019