Alex Rivera | Logout

What does an object file contain?

Asked 2010-06-15T13:33:27.733
60

During the various stages of compilation in C or C++, I know that an object file gets generated (i.e., any_name.o file). What does this .o file contain? I can't open it since it's a binary file.

Could anybody please help me? Are the contents of the object file mainly dependent on the compiler which we use on Unix?

Edit
Report

1 Answer

5

The object file is the compiled source.

This means that it's machine code, which is dependent on the target platform (you can compile for Unix on Windows if you really want to) and the compiler used. Different compilers will produce different machine code from the same source file.

answered 2010-06-15T13:35:03.830

Your Answer