"Vinod" <[EMAIL PROTECTED]>,
  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"
{
#endif

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

#if defined(__cplusplus)
}
#endif



"> 
"> Thanks much.
"> 
"> - Vinod.
"> 
">                                                            

Robert Heller             -- 978-544-6933
Deepwoods Software        -- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
[EMAIL PROTECTED]       -- Contract Programming: C/C++, Tcl/Tk






               
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to