关于使用 c 进行汇编
我刚刚完成了学校的一项必修任务,我即将完成它。
但后来我遇到了一些不熟悉的东西,头文件。 :(
我得到的是:
test-program.c
task_header.h
function1.s
function2.s
function3.s
function4.s
test-program.c:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "task_header.h"
.
..
...
task_header.h:
extern void function1(...);
extern void function2(...);
extern int function3(...);
extern void function4(...);
然后我使用命令:
gcc -m32 -o runtest test-program.c function1.s function2.s function3.s function4.s
这是正确的方法吗,或者是否可以修改它?所以我可以输入: </
gcc -m32 -o runtest test-program.c
强><强>?
I've sort of just finished a mandatory task at school, and I'm about to deliver it.
But then I came across something that was unfamiliar, header files. :(
What I've got:
test-program.c
task_header.h
function1.s
function2.s
function3.s
function4.s
test-program.c:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "task_header.h"
.
..
...
task_header.h:
extern void function1(...);
extern void function2(...);
extern int function3(...);
extern void function4(...);
And then I use the command:
gcc -m32 -o runtest test-program.c function1.s function2.s function3.s function4.s
Is this a proper way to do it, or is it possible to modify it? So I can type:
gcc -m32 -o runtest test-program.c
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个完全合理的方法。
您通常也会编写一个 makefile,这样您只需键入
make
而不必记住构建指令。或者,也许只是一个脚本,这样您就可以执行./build.sh
。我将保留这些文件作为练习。
That's a perfectly reasonable way to do it.
You'd normally write a makefile as well, so that you can just type
make
and not have to remember the build instructions. Or, perhaps, just a script so you can do a./build.sh
.I'll leave those files as an exercise.