[Top][All Lists]

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

linking a C program with a C++ library on Solaris

From: Tim Mooney
Subject: linking a C program with a C++ library on Solaris
Date: Mon, 25 Feb 2008 16:46:51 -0600 (CST)

I've been building and packaging a lot of software in the past couple
weeks on my x86_64-sun-solaris2.10 workstation.  I've been using the
Sun Workshop 12 C and C++ compilers for the builds.

I've run into several situations in the past week where I'm building a
package that's mainly written in C (nautilus, tracker, faac, et. al.) that
wants to link with a C++ library (exempi, mpeg4ip).  In all the
permutations I've encountered so far, both the C++ library and the C
package are using libtool, and I've always updated both to use 1.5.26.

On Solaris, if you are linking against any C++ objects, you must use the
C++ compiler to link.  I don't know if that's common to other platforms
or not, as I don't have access to the plethora of UNIX platforms I used
to.  In any case, the packages I've encountered don't seem to expect that,
so the (libtool) link stage for the C project doesn't know to use C++,
and the link fails.

Is this something that libtool could be (should be?) handling
automatically?  Even if it can't be handled automatically, is there
something that libtool could be doing to help make it easier for packages
that are primarily C (but link against C++ libraries/objects) to know that
they need to "switch to" C++ for linking in their C project?

Tim Mooney                              address@hidden
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

reply via email to

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