Run Ant with -verbose, and you'll see the command line issued. I bet
you'll see that despite using the "g++" compiler name, it uses "gcc"
in the command line.

I believe g++ is equivalent to gcc, linking with stdc++, so if you add
a linker arg or a libset, you should be fine.

Note that you should note typedef individual tasks/types like you do.
Use the in-Jar properties files, or better yet XML namespaces. Sorry,
don't have examples to show you right now. --DD

On 7/7/06, Stuart Brown <[EMAIL PROTECTED]> wrote:
Hi

I'm trying to get running on Ant. I have Ant 1.6.5 running on Fedora
Core 5 and I'm using gcc/g++ v4.1.1.

I have a simple C++ program in file hello.cpp as follows

#include <iostream>
int main()
{
 std::cout << "CPP Hello world\n";
 return (0);
}

This build fine with the command line g++ -o hello hello.cpp

I have the following ant build.xml file
<?xml version="1.0"?>

<project name="CppHelloWorld" default="main" >

<taskdef name="cc" classname="net.sf.antcontrib.cpptasks.CCTask"/>
<typedef name="linker"
classname="net.sf.antcontrib.cpptasks.LinkerDef"/>
<typedef name="compiler"
classname="net.sf.antcontrib.cpptasks.CompilerDef"/>

<target name="main" description="Incremental build of software suite.">
 <cc name="g++"
     outfile="hello"
     outtype="executable"
     subsystem="console">
   <fileset dir=".">
     <include name="*.c"/>
   </fileset>
 </cc>
</target>

</project>

When I try do an ant build I get the following
[code]$ ant
Buildfile: build.xml

main:
      [cc] Starting dependency analysis for 1 files.
      [cc] 1 files are up to date.
      [cc] 0 files to be recompiled from dependency analysis.
      [cc] 0 total files to be compiled.
      [cc] Starting link
      [cc] hello.o:(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
      [cc] collect2: ld returned 1 exit status

BUILD FAILED
/home/sbrown/temp/build.xml:13: gcc failed with return code 1

Total time: 2 seconds


This is the same error as I get if I try compile with  the command gcc
-o hello hello.cpp

Please help me to understand what is incorrectly configured, is it ANT
or gcc and how do I fix this?

Thanks

Stuart Brown



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to