[Top][All Lists]

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

Re: Mixing C and C++?

From: Erik de Castro Lopo
Subject: Re: Mixing C and C++?
Date: Fri, 6 Jun 2008 21:49:15 +1000

Ralf Wildenhues wrote:

> Please post a small example package that exposes this, or, if that's too
> much work, the and tests/ files; and state which
> program versions you use.

Trying to set up a test showed up an even bigger problem. I'm using:

    automake (GNU automake) 1.9.6
    autoconf (GNU Autoconf) 2.61 (GNU libtool) 1.5.26 Debian 1.5.26-1ubuntu1 (1.1220.2.493 
2008/02/01 16:58:18)

installed from packages on an Hardy Heron machine.

The test project is here:

If I extract these sources and do:

    ./ (which also runs configure)

it results in the following error:

    if gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -MT amtest.o -MD -MP \
                 -MF ".deps/amtest.Tpo" -c -o amtest.o amtest.c; \
        then mv -f ".deps/amtest.Tpo" ".deps/amtest.Po"; else rm -f \
        ".deps/amtest.Tpo"; exit 1; fi
    /bin/bash ./libtool --tag=CC --mode=link gcc  -g -O2   -o amtest  amtest.o  
    mkdir .libs
    gcc -g -O2 -o amtest amtest.o   
    amtest.o: In function `main':
    /tmp/amtest-0.1/amtest.c:10: undefined reference to `cpp_test'

For some reason, the automake generated Makefile drops the C++ object
file from the link.

What am I doing wrong here?

Erik de Castro Lopo
"Two hands working can do more than a thousand clasped in prayer."
-- anonymous

reply via email to

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