ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject Re: linking with CC task
Date Thu, 29 Nov 2007 15:42:15 GMT
On Nov 26, 2007 6:30 PM, fabien_pichard <fabien_pichard@hotmail.com> wrote:
> I went to http://ant-contrib.sourceforge.net/cc.html to try to understand
> how linking worked but I still cannot make it work at all...
>
> <project name="C build" basedir="."
> xmlns:cpptasks="antlib:org.sf.net.antcontrib.cpptasks"
> xmlns:antcontrib="antlib:net.sf.antcontrib">

Since you've put cpptasks.jar in ${ant.home}/lib, and you use
xmlns:cpptasks, you don't need to <taskdef> and <typedef> it. Simply
use <cpptasks:cc> instead.

And if cpptasks.jar wasn't in ${ant.home}/lib, you'd have to have used
a loaderref so the <taskdef> and <typedef> used the same class loader.
Just in FYI.

Same applies to Ant-Contrib. So use xmlns or task/typedef, but not both.

>   <target name="cmpdebug" depends="init" description="Compile the source " >
>     <cc name="msvc"
>         objdir="${debug.dir}"
>         debug="1"
>         rebuild="1"
>         warnings="severe"
>         optimize="none"
>         exceptions="true">

Don't you need to specify whether it's a .exe or .dll? It's been a while...

>         <linker name="msvc"
>                 debug="1"
>                 rebuild="1">
>                 <fileset dir="${debug.dir}" includes="*.obj"/>
>         </linker>

I don't think you need an explicit linker, since you used <cc
name="msvc">, and you also don't need to use a fileset for obj, as
<cc> knows about them as products of the compilation of the C sources.

I don't have my CppTasks builds with me anymore, and it's been a
couple years, so it's becoming fuzzy...

> It will compile and I will have an OBJ, but it won't link... and ANT does
> not fail anywhere...
> What am I doing wrong?

Try running with -verbose, and study the output. Might provide some
insight. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message