Компиляция программы на C с использованием ant-contrib с помощью cpptasks - PullRequest
3 голосов
/ 12 апреля 2011

Вот как выглядит мой build.xml файл:

<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/varun/Desktop/lucene/3018-test">
           <fileset file="/home/varun/Desktop/lucene/3018-test/hello.c" />
        </cpptasks:cc>
    </target>
</project>

Когда я запускаю команду ant build-native, я получаю сообщение об ошибке:

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

Но мой CLASSPATH установлен на /usr/share/ant/lib, и я поместил ant-contrib-1.0b3.jar в /usr/share/ant/lib/ant-contrib-1.0b3.jar.

Что я делаю не так?

1 Ответ

4 голосов
/ 12 апреля 2011

cpptask не входит в ant-contrib-*.jar.Вы должны загрузить , что отдельно.

Я только что попробовал cpptasks-1.0-beta5, но он не скомпилирован.cpptasks-1.0-beta4 имел предварительно скомпилированный jar в архиве, и это работало нормально.

...