开发者

Compiling a C program using ant-contrib using cpptasks

This is what my build.xml file looks like:

<project name="test" xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks">
    <target name="build-native">
        <mkdir dir="/home/varun/Desktop/lucene/3018-test/check"/>
        <cpptasks:cc outtype="executable" subsystem="console" outfile="BuildNativeDir" objdir="/home/开发者_StackOverflow社区varun/Desktop/lucene/3018-test">
           <fileset file="/home/varun/Desktop/lucene/3018-test/hello.c" />
        </cpptasks:cc>
    </target>
</project>

When I run the command ant build-native I get an error:

BUILD FAILED
/home/varun/Desktop/lucene/3018-test/build.xml:4: Problem: failed to create task or type antlib:net.sf.antcontrib.cpptasks:cc
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of:
        -/usr/share/ant/lib
        -/home/varun/.ant/lib
        -a directory added on the command line with the -lib argument


Total time: 0 seconds

But my CLASSPATH is set to /usr/share/ant/lib and I have placed the ant-contrib-1.0b3.jar in /usr/share/ant/lib/ant-contrib-1.0b3.jar.

What am I doing wrong?


cpptask is not included in ant-contrib-*.jar. You have to download that separately.

I just tried cpptasks-1.0-beta5 but it did not compile. cpptasks-1.0-beta4 had a precompiled jar in the archive and that worked fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜