This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430FR2433:如何包含.c 源文件?

Guru**** 2531950 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1205130/msp430fr2433-how-to-include-a-c-source-file

器件型号:MSP430FR2433

我正在尝试在 CCS 项目中包含一个定制源文件(.c)、以便我写出所有函数定义。

每当我尝试构建工程时、都会收到以下错误:


#10056符号"init_gpios"重新定义:首先在"./init.obj"中定义;在"./main.obj"中重新定义 Actor_Control C/C++问题

我在 init.c 文件中只定义了一个函数-为什么会出现此错误?

e2e.ti.com/.../Actuator_5F00_Control.zip

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如果#include init.c 文件并有 init.obj 对象,这就是问题所在。 您已将.c 文件告知 IDE、它已对其进行编译。

    将其包含在内或者单独编译。 单独编译通常更好。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    CCS 不会询问您有关 init.c 的信息、它会自动将其(单独)添加到构建列表中。 右键单击文件名并选择"exclude from build"。

    [编辑:更一般地说,我同意 David 的观点——除非有充分的理由,否则不要#包含它,只需单独构建它。]