Article View: comp.unix.programmer
Article #3555Re: static/shared linking with C and C++
From: Anon
Date: Tue, 19 Nov 2002 16:16
Date: Tue, 19 Nov 2002 16:16
21 lines
1936 bytes
1936 bytes
Jean-Marc Bourguet wrote:
> "@please@no.spam" <""ddrav\"@please@no.spam"> writes:
>
>
>>Now I'm trying to add a program written in C++ to the suite. I find
>>that if I compile libutil.a with gcc the C++ program can't link with
>>it (unresolved references) and if I compile it with g++ the C
>>programs can't use it. Do I need to keep two versions around or is
>>there some magic switch I'm missing?
>
>
> This is a pure C++ question. You should put
>
> #ifdef __cplusplus
> extern "C" {
> #endif
Oh, I should have known that (and did in some dark corner of my brain).
Thanks and sorry for the dumb question.
DD
Technical Details
Message-ID:
<vttC9.53098$__1.30508@rwcrnsc51.ops.asp.att.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mailReferences:
<HFsC9.52551$__1.29668@rwcrnsc51.ops.asp.att.net> <pxbwun9zi07.fsf@news.bourguet.org>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,68b09b041b067487 X-Google-Attributes: gid11318c,public X-Google-Thread: fc89c,68b09b041b067487 X-Google-Attributes: gidfc89c,public X-Google-ArrivalTime: 2002-11-19 08:16:28 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: "@please@no.spam" <""ddrav\"@please@no.spam"> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.unix.programmer,gnu.gcc.help Subject: Re: static/shared linking with C and C++ References: <HFsC9.52551$__1.29668@rwcrnsc51.ops.asp.att.net> <pxbwun9zi07.fsf@news.bourguet.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 22 Message-ID: <vttC9.53098$__1.30508@rwcrnsc51.ops.asp.att.net> NNTP-Posting-Host: 66.31.43.190 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1037722587 66.31.43.190 (Tue, 19 Nov 2002 16:16:27 GMT) NNTP-Posting-Date: Tue, 19 Nov 2002 16:16:27 GMT Organization: AT&T Broadband Date: Tue, 19 Nov 2002 16:16:27 GMT