首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用cpptask使用ant-contrib编译C程序

使用cpptask使用ant-contrib编译C程序
EN

Stack Overflow用户
提问于 2011-04-12 23:55:39
回答 1查看 3.5K关注 0票数 3

这是我的build.xml文件的样子:

代码语言:javascript
复制
<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时,我得到一个错误:

代码语言:javascript
复制
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中。

我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-13 00:17:36

ant-contrib-*.jar中不包含cpptask。您必须单独对其执行download

我刚试过cpptasks-1.0-beta5,但它不能编译。cpptasks-1.0-beta4在归档文件中有一个预编译的jar,它工作得很好。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5638149

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档