【问题标题】:GCC: mixed C/assembly project - include directiveGCC:混合 C/汇编项目 - 包含指令
【发布时间】:2017-02-07 09:15:06
【问题描述】:

我有一个庞大的项目,包括:

  • main.c 包含 main 函数并从 abc.S 调用函数 - 仅此而已!
  • abc.S 执行一些初始化步骤,然后调用其他汇编例程
  • a1.S, a2.S, ... 其中包含由 abc.S 调用的函数

abc.S 包含所有文件,如下所示:

.include "a1.S"
.include "a2.S"
.include "a3.S"

现在我想包含一个名为definitions.h 的文件,其中包含一些define MEOW 123,我想在例如使用MEOW a1.S - 我的 makefile 必须看起来如何才能实现这种行为?我必须在哪里包含definitions.h

我尝试了一些东西,但最终只有错误。

【问题讨论】:

    标签: c gcc assembly include c-preprocessor


    【解决方案1】:

    自己想通​​了 - makefile 可能看起来像这样:

    all:
                gcc -o abc a1.S a2.S a3.S abc.S main.c
    clean:
                rm -rf abc
    

    a1.S 中包含definitions.h,在abc.S 中包含a1.S

    【讨论】:

      猜你喜欢
      • 2017-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-18
      • 2020-10-27
      • 2010-12-31
      相关资源
      最近更新 更多