`

c++ build 和 compile

 
阅读更多

一个C/C++程序的生成要经历以下步骤: 

1.编写文本代码,生成C或cpp文件,这时候它还是文本的; 

2.编译,就是compile,由C编译程序对你写的代码进行词法和句法分析,发现并报告错误,有错时编译不能通过。如若无错,则生成中间代码,扩展名为obj,此时它便是二进制的了; 

3.连接,在汇编里称link,在C里叫生成,即build,它的作用是生成可执行的exe文件。由于一个程序的源码可由多个文件组成。这些文件在第二步中分别编译,生成各自的目标文件(*.obj),这一步的作用便是将这些obj文件,以及程序中需要的其它库文件(dll除开),统一到一个文件中来,形成单个的exe文件。此exe文件便可以在操作系统下直接运行了。 

上述第二步做完中间代码生成的工作后还有个代码优化,这里就不详讲了。 

compile、build分别对应编译和连接这两个过程。

 

===================================================

 

compile只是将某个C或者CPP文件编译成obj文件,而build是将整个工程中的文件先Compile(编译),然后将编译生成的文件再Link(连接)成可执行文件。

分享到:
评论

相关推荐

    Sams Teach Yourself C++ in One Hour a Day (8th Edition).pdf(21天学通C++ 第8版 英文版)

    Learn the Standard Template Library and the containers and algorithms used in most real-world C++ applications * Learn how to build effective programs in C++ with hands-on exercises * Get expert tips ...

    C++ Templates The Complete Guide, 2nd Edition

    on, three pioneering C++ experts show why, when, and how to use modern templates to build software that’s cleaner, faster, more efficient, and easier to maintain. Now extensively updated for the ...

    C++ Crash Course- A Fast-Paced Introduction 2019.rar

    Author: Josh Lospinoso Pub Date: 2019 ISBN: 978-1593278885 ...With well over 500 code samples and nearly 100 exercises, C++ Crash Course is sure to help you build a strong C++ foundation.

    C++ Templates The Complete Guide, 2nd Edition epub

    on, three pioneering C++ experts show why, when, and how to use modern templates to build software that’s cleaner, faster, more efficient, and easier to maintain. Now extensively updated for the ...

    C++ Templates The Complete Guide 2nd Edition

    In C++ Templates, Second Edition, three pioneering C++ experts show why, when, and how to use modern templates to build software that’s cleaner, faster, more efficient, and easier to maintain. ...

    C++Builder™ 6 Developer’s Guide

    To my knowledge, this is the only C++ implementation that enables you to build C++ applications on the fly, just as easy as with Delphi or Visual Basic. For programmers who are apprehensive of C++, I...

    C++实验报告(4).doc

    } (4)选择Build—Compile test.cpp命令,对此程序进行编译。观察和分析编译信息。 (5)根据编译信息指出的错误,修改程序。再进行编译,如果还有错,再重复此过程 ,直到编译不出错为止。修改通过的正确程序为:...

    Hands-On Game Development with WebAssembly Learn WebAssembly C++.epub

    It promises a world where you can write an application for the web in any language, and compile it for native platforms as well as the web. This book is designed to introduce web developers and game...

    THE BOOST C++ METAPROGRAMMING LIBRARY

    This paper describes the Boost C++ template metaprogramming library (MPL), an extensible compile-time framework of algorithms, sequences and metafunction classes. The library brings together important...

    Bloodshed Dev-C++

    * "Compile as C++" per-unit * "Include file in compilation process" per-unit * Project version info (creates the relevant VERSIONINFO struct in the private resource) * Support XP Themes (creates the ...

    Bear是一种工具,可生成用于clang工具的编译数据库。-C/C++开发

    Build EAR(BEAR)熊是一种工具,可生成用于clang工具的编译数据库。 在clang项目中使用JSON编译数据库来提供有关如何处理单个编译单元的信息。 机智构建EAR(BEAR)Bear是一种工具,可为clang工具生成编译数据库。 ...

    A JSON parser in C++

    Build Status Introduction JSON++ is a light-weight JSON parser, writer and reader written in C++. JSON++ can also convert JSON documents into lossless XML documents. Contributors ...

    基于C++和opencv视觉捕捉与贪心算法路径规划的网球自拾取机器人系统源码+使用说明.zip

    基于C++和opencv视觉捕捉与贪心算法路径规划的网球自拾取机器人系统源码+使用说明.zip title: "网球收集机器人网球识别与路径规划" description: "网球收集机器人网球识别与路径规划" 说明 上图中展示了当两个网球...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Other C++ Features Reference Arguments Function Overloading Default Arguments Variable-Length Arrays and alloca() Friends Exceptions Run-Time Type Information (RTTI) Casting Streams Preincrement and ...

    EhLib 6.3 Build 6.3.176 Russian version. Full source included.

    EhLib 6.3 Build 6.3.176 Russian version. Full source included. ------------------------------------------------------------------- The Library contains components and classes for Borland Delphi ...

    Rad Studio Delphi C++builder XE 10.4 Patch2

    RSP-28717 Delphi Package fails to compile RSP-28701 Bind visually on TDBGRID kills the IDE RSP-28669 [BadCG] Value M-record parameters: improper AddRefRecord RSP-28659 RVO for M-records: assignment to...

    基于TensorRT的高性能单目标跟踪推理c++源码(支持OSTrack、LightTrack)+使用说明.zip

    5.期待你能在项目中找到乐趣和灵感,也欢迎你的分享和反馈! 【资源说明】 基于TensorRT的高性能单目标跟踪推理c++源码(支持OSTrack、LightTrack)+使用说明.zip 基于 TensorRT 的 C++ 高性能 单目标跟踪 推理,支持...

    inclusion-mapper:基于 clang 的 C++ 包含映射生成器

    包含映射器是一个工具,它生成一个描述 C++ 代码库中不同文件之间的链接。 它使用 Clang LibTooling 接口并与 CMake 构建系统配合使用。 构建包含映射器 包含映射器具有以下构建时间先决条件: 制作 促进 铛 检出...

    cpp checker

    The original name of this program is "C++check" but it was later changed to "cppcheck". Manual A manual is available online: http://cppcheck.sourceforge.net/manual.pdf Compiling Any C++11 ...

    Qt5 3D官方教程配套示例代码

    meshes of Qt3D directly into place, as part of the compile process. The files go into the bin/ directory, and the executables can be run directly from there. If you are doing a developer build, ...

Global site tag (gtag.js) - Google Analytics