source. and output.

本文详细介绍了 Eclipse PDE 构建系统中 source 和 output 属性的作用及使用方法。通过设置 source 属性可以指定要编译的源文件夹,而 output 属性则指定了编译结果存放的位置。此外还解释了 .classpath 文件如何存储这些信息,并提供了一些实际的配置示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The source and output properties in build.properties control the folders to be compiled and where to place the resulting output. The eclipse help briefly talks about it.
    * source.<library> - lists source folders that will be compiled (e.g. source.xyz.jar=src/, src-ant/). If the library is specified in your plug-in.xml or manifest.mf, the value should match it;
    * output.<library> - lists the output folder receiving the result of the compilation;


Source Folders and Output Folders

Source and Output folder have already been discussed in this post. Only the source folders gets compiled and the generated class files get stored in the corresponding output folder. A project can have one or more source folder. If a source folder does not have a output folder attached to it explicitly, its output will go to the default output folder. The .classpath file stores all this information.

source.. and output..

The real syntax is source.<library> and output.<library> where <library> is generally the name of the jar. Here the second dot signifies the default library. Any source folder assigned to it gets it output reside in the root when the plug-in is build. The output.. entry tells the PDE Build where to pick the classes for source.. from.

Typical entries look like this

source.. = src/
output.. = bin/

 

When a plug-in with above entries is build the structure of the plug-in jar will look like this
org.example.sample_1.0.0
│   plugin.xml
│
├───icons
│       sample.gif
│
├───META-INF
│       MANIFEST.MF
│
└───org
    └───example
        └───sample
            │   Activator.class
            │
            └───actions
                    SampleAction.class

 

More complex plug-ins have more than one source folder. org.eclipse.pde.core is one such plug-in. It is good practice to assign separate output folder for separate source folders. This is not mandatory.
Lets assume src and src_an are the two source folders and their corresponding output folders are bin and bin_ant . Then a build.properties like
source.. = src/
output.. = bin/
source.ant_tasks/anttasks.jar = src_ant/
output.ant_tasks/anttasks.jar = bin_ant/

will create a plug-in which will look something like this

org.example.sample_1.0.0
│   plugin.xml
│
├───ant_tasks
│       anttasks.jar
│
├───icons
│       sample.gif
│
├───META-INF
│       MANIFEST.MF
│
└───org
    └───example
        └───sample
            │   Activator.class
            │
            └───actions
                    SampleAction.class
The contents of the src_ant folder will get compiled and jared in to anttasks.jar inside ant_tasks folder because of the source.ant_tasks/anttasks.jar = src_ant/ entry.


Classpath vs source/output entries

The source folder and output folder information is already available in class path then why source/output entries are needed? The classpath entries are used to compile source code. But the PDE Build relies on the source/output entries while building (or exporting) the plug-ins. Suppose a plug-in A refers to a class C in plug-in B. Then while building the plug-in A PDE Build will look into build.properties of plug-in B to locate the C.class .


Rules of using source. and output. entries

  1. Every source folder should appear in a source. entry.
  2. A source folder can appear in one and only one source. entry.
  3. The source and output folders are specified as their path relative to the root of the project.
  4. All source folders whose output folder is same should belong to same source. entry.
  5. The corresponding output folders should be mentioned in the corresponding output.entry.
Note that should in above rules means that rule is a good practice and not an obligation but if not followed the result of PDE Build might be unexpected.
引用\[1\]和\[2\]提到了类似的错误,即符号(Symbol)被多次定义。在你的问题中,错误信息是"..\..\Output\USART.axf: Error: L6200E: Symbol zhengzhuan multiply defined (by motor.o and main.o)"。这意味着在motor.o和main.o文件中都定义了名为"zhengzhuan"的符号,导致了重复定义的错误。 为了解决这个问题,你可以采取以下方法: 1. 确保在整个项目中只有一个地方定义了"zhengzhuan"符号。检查motor.c和main.c文件,确保只在其中一个文件中定义了"zhengzhuan"变量或函数。 2. 如果你需要在其他地方引用"zhengzhuan"变量,可以在其他文件中使用extern关键字来引用它,而不是重新定义它。这样可以避免重复定义的错误。 希望这些方法能帮助你解决编译错误。如果问题仍然存在,请检查你的代码并确保没有其他地方重复定义了"zhengzhuan"符号。 #### 引用[.reference_title] - *1* [STM32编译错误:…\OBJ\USART.axf: Error: L6200E: Symbol __stdout multiply defined](https://blog.csdn.net/qq_41274498/article/details/128243334)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [关于..\OBJ\Template.axf: Error: L6200E: Symbol t multiply defined (by huidu.o and main.o)....](https://blog.csdn.net/bukeyandong/article/details/118467156)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值