delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/05/02/10:17:58

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Date: Tue, 2 May 2000 17:18:29 +0200 (MET DST)
From: Bobak Csaba <h531649 AT sirius DOT cab DOT u-szeged DOT hu>
X-Sender: h531649 AT sirius
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Newbie: libProblem.a
Message-ID: <Pine.GSO.4.21.0005021707150.22009-100000@sirius>
MIME-Version: 1.0

Hi all!

After searching the archives I have to ask this:
How do I compile my prg of two libs and an executable if one of the libs
calls functions from the other one?
Simplified case:

a.c:
...
int foo_a(int x)
{
 return x+1;
}
...

b.c:
...
extern foo_a(int);
...
int foo_b(int y)
{
 return foo_a(y-1);
}
...

main.c:
...
extern foo_b(int);
...
cout<<foo_b(3);
...

What I tried:
gcc -c a.c
ar cq liba.a a.o
ranlib liba.a
gcc -c b.c
ar cq libb.a b.o
ranlib libb.a
gcc -o main main.c -L. -la -lb

The last command gave an 'undefined' with foo_a
What did I do wrong?


		Csaba


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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