ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Brown <>
Subject Ant won't call g++
Date Fri, 07 Jul 2006 14:02:19 GMT

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"
<typedef name="compiler"

<target name="main" description="Incremental build of software suite.">
  <cc name="g++"
    <fileset dir=".">
      <include name="*.c"/>


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

       [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
       [cc] collect2: ld returned 1 exit status

/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?


Stuart Brown

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message