public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* linking it right.
@ 2001-03-02  5:51 Eric Tchepannou
  2001-03-02  8:58 ` Alexandre Oliva
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Tchepannou @ 2001-03-02  5:51 UTC (permalink / raw)
  To: gcc-help

Hi all,


   I have created a library from a C program and would lie to use it in 
another C++ programm. This lead to some problems. Can somebody please help 
me?

Desc.:

	1 - At the beginning I have lex and yacc files:
        	famcheck.y -- with the method int famcheck (char *) famcheck.lex

        2 - With lex famcheck.lex and yacc famcheck.y I create 2 .c files:
      		lex.yy.c
                y.tab.c

	3 - gcc -c *.c and then ar -cr *.o ==> ../lib/libfamcheck.a

	4 - I have a header file named dc_famcheck.h with the prototype
		int famcheck (char *); from (famcheck.y ==>) y.tab.c


Now the other side:

	a - I have the following C++ files:
        	dc_output.cpp
                dc_scan.cpp
                dc_functions.cpp
                depcheck.cpp --this one includes dc_famcheck.h in order to 
use the method int famcheck (char *)

	b - Compilation:
        	g++ -c {dc_output|dc_scan|dc_functions}.cpp and then
                g++ -c depcheck.cpp -L../lib -lfamcheck

	this gives me the error messages:
        	g++: -lfamcheck : linker input file unused since linking not done.

	then creating my executable results to an unsatisfying symbol: int famcheck 
(char*);

PS : I am using SuSE Linux with gcc-2.95.2


Thanx

--
Eric Tchepannou
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com .

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: linking it right.
  2001-03-02  5:51 linking it right Eric Tchepannou
@ 2001-03-02  8:58 ` Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2001-03-02  8:58 UTC (permalink / raw)
  To: Eric Tchepannou; +Cc: gcc-help

On Mar  2, 2001, "Eric Tchepannou" <etchepannou@hotmail.com> wrote:

> 	b - Compilation:
>         	g++ -c {dc_output|dc_scan|dc_functions}.cpp and then
>                 g++ -c depcheck.cpp -L../lib -lfamcheck
                      ^^

> 	this gives me the error messages:
>         	g++: -lfamcheck : linker input file unused since linking not done.

-c means compile only.  You can only specify libraries when linking.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-03-02  8:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-02  5:51 linking it right Eric Tchepannou
2001-03-02  8:58 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).