[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-ppc
Subject: Compile problems
From: Adam Dershowitz <dersh () houston ! rr ! com>
Date: 2000-07-10 2:17:31
[Download RAW message or body]
I have been trying to compile some c code and running into problems. I
finally reduced the problem to how
external variables are being handled. I am using gcc 2.95.2-1g
I tried creating two files, then compiling them:
Here is test1.c
#include <stdio.h>
extern int a;
main()
{
printf("Hello world\n");
a=2;
testfun();
a=4;
testfun();
}
And here is test2.c
extern int a;
testfun()
{
printf("Now got into testfun\n");
printf("a = %i\n",a);
}
At the command line I type> gcc test1.c test2.c
and I get the following list of errors:
/tmp/cca2PpML.o: In function `main':
/tmp/cca2PpML.o(.text+0x26): undefined reference to `a'
/tmp/cca2PpML.o(.text+0x2e): undefined reference to `a'
/tmp/cca2PpML.o(.text+0x36): undefined reference to `a'
/tmp/cca2PpML.o(.text+0x3e): undefined reference to `a'
/tmp/ccvyFtQG.o: In function `testfun':
/tmp/ccvyFtQG.o(.text+0x26): undefined reference to `a'
/tmp/ccvyFtQG.o(.text+0x32): more undefined references to `a' follow
collect2: ld returned 1 exit status
Am I missing something really obvious? Is there a bug in gcc? Any help
would be greatly appreciated.
--Adam
** Sent via the linuxppc-user mail list. See http://lists.linuxppc.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic