[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: g++/gcc compatibility issue.

From: Robert Heller
Subject: Re: g++/gcc compatibility issue.
Date: Tue, 14 Mar 2006 22:21:34 +0100

  "Vinod" <>,
  In a message on 14 Mar 2006 11:02:28 -0800, wrote :

"> Hi,
"> I am trying to compile a C++ application using g++, and I have a
"> C-library which was compiled using gcc. When I try to link my C++
"> application with the C-library, I face linker errors related to
"> undefined symbol references (even though the functions are actually
"> defined in the libraries). Is there any option/flag in g++/gcc for C++
"> applications to link to C-libraries. 

Did you wrap the C-code function declarations with 'extern "C"'?  If
you don't, the C++ compiler will 'mangle' the names (to allow for
overloading).  Eg:

#if defined(__cplusplus)
extern "C"

int someCfunction(int arg1, double arg2);
int someotherCfunction(char *foo);

#if defined(__cplusplus)

"> Thanks much.
"> - Vinod.

Robert Heller             -- 978-544-6933
Deepwoods Software        -- Linux Installation and Administration  -- Web Hosting, with CGI and Database       -- Contract Programming: C/C++, Tcl/Tk


reply via email to

[Prev in Thread] Current Thread [Next in Thread]