编译状态后的目标代码到底是什么?

What exactly is an Object code after a compiled state?

我知道目标代码是编译阶段之后出现在目标文件中的代码(例如:aaa.obj)。这个文件是什么?包含机器指令?如果是这样,为什么我在该文件中看不到任何 0 和 1。 请帮帮我。

What's an object file in C?

An object file is the real output from the compilation phase. It's mostly machine code, but has info that allows a linker to see what symbols are in it as well as symbols it requires in order to work. (For reference, "symbols" are basically names of global objects, functions, etc.)

A linker takes all these object files and combines them to form one executable (assuming that it can, ie: that there aren't any duplicate or undefined symbols). A lot of compilers will do this for you (read: they run the linker on their own) if you don't tell them to "just compile" using command-line options. (-c is a common "just compile; don't link" option.)


If so why can't I see any 0's and 1's in that file.

您混淆了目标文件的概念和可执行文件的概念。问题是目标文件包含链接器的编译代码和指令(从一个或多个目标文件构建一个可执行文件的程序)。链接器程序的输出实际上是可执行文件,其中包含您期望的零和一。