如何使用cl.exe创建obj文件

时间:2016-04-07 10:00:20

标签: c cl

我有一个标题(.h)和一个c(.c)文件。如何在cl.exe中使用它们创建对象.obj文件?

2 个答案:

答案 0 :(得分:1)

cl /Wall /Fo foo.obj foo.c 

Explanation:

/Wall enables more warnings. You want this!

/Fo foo.obj creates an object file named foo.obj

foo.c This is your input C file. It must #include "yourHeaderFile.h"

答案 1 :(得分:0)

如有必要,您可以在.c文件中包含.h文件。

#include "xxxxx.h"

使用/ c仅在没有链接的情况下进行编译。

总结一下,

cl /c xxxxx.c
相关问题