【问题标题】:Makefile -o, why need .oMakefile -o,为什么需要.o
【发布时间】:2019-10-24 16:05:20
【问题描述】:

当我们想一起编译一个多文件时。

为什么我们需要在 makefile 中将 .c 文件转换为 .o 而不仅仅是 gcc file1.c file2.c -o newfile

例如

\\ in make file
file: file1.c file2.c 
     gcc file1.c file2.c -o combination

\\ we can just call make in the terminal
\\ i have watch video on youtube, why people using file1.o file2.o. why we need to convert .c file to .o instead of just gcc the file and ./ execute it?

【问题讨论】:

标签: c gcc makefile compiler-errors


【解决方案1】:

你不需要。继续这样做;它适用于非常简单的情况。

Makefile 在以下情况下很有用所以你只想重新编译改变的文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-15
    • 1970-01-01
    • 1970-01-01
    • 2019-10-23
    • 2020-02-21
    • 2017-09-18
    相关资源
    最近更新 更多