Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2003 06:44:40 -0700 (PDT)
From:      Gerald Pfeifer <gerald@FreeBSD.org>
To:        bostic@sleepycat.com, gerald@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject:   Re: gnu/13525: gcc fails load against library with both C++ and C modules
Message-ID:  <200305211344.h4LDiew9035764@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
Synopsis: gcc fails load against library with both C++ and C modules

State-Changed-From-To: feedback->closed
State-Changed-By: gerald
State-Changed-When: Wed May 21 06:41:18 PDT 2003
State-Changed-Why: 
I debugged this in further depth, and it is apparently operator error: As
soon as you use any C++ library routines (whether directly or indirectly)
you need to link the final binary using g++, not gcc, and the g++ driver
then will link any additional libraries required.

The following would have worked for the example provided:
  gcc -Wall -c -fpic a.c
  c++ -Wall -c -fpic b.cc
  gcc -shared -o libab.so a.o b.o
  gcc -Wall -c c.c
  c++ -o c c.o ./libab.so

http://www.freebsd.org/cgi/query-pr.cgi?pr=13525



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305211344.h4LDiew9035764>