我想在源文件的父目录或子目录中包含一些文件。 NASM 可以吗?
最佳答案
NASM 有多种方法将一个文件包含在另一个文件中。
%include
指令:
其工作方式类似于C
中的#include
指令,例如您可以像 %include "some_dir/awesome.asm"
这样编写相对路径。如果您不想在源代码中每次都指定文件的相对路径,您可以通过 -i option 确定包含文件搜索目录。
预处理后,可以使用-E option看到实际输出.
- 预包含文件(引自 the docs ):
NASM allows you to specify files to be pre-included into your source file, by the use of the
-p
option.
nasm myfile.asm -p myinc.inc
is equivalent to runningnasm myfile.asm
and placing the directive%include "myinc.inc"
at the start of the file.
关于include - NASM - 相关包含文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6292999/