Sign in to follow this  

C++

This topic is 4868 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Tell me if Im wrong... When you make a C++ application and compile it.. the compiler creates an "*.obj" file with "Assembly" code in it.. then compiles it.. thats the reason we have pre-compilers like "#include", "#difine",.. right?

Share this post


Link to post
Share on other sites
Quote:
Original post by amonrabrasil
Tell me if Im wrong...

When you make a C++ application and compile it.. the compiler creates an "*.obj" file with "Assembly" code in it.. then compiles it.. thats the reason we have pre-compilers like "#include", "#difine",..


right?


Compilation consists of multiple steps:

1. Preprocessing (not pre-compiling) using #include for example
2. Compilation: transform your code into some binary form (object files)
3. Linking: put together all object files and create an executable

If you write assembler code, you need an assembler to create object code which may be linked together with all the other files.

Share this post


Link to post
Share on other sites
Not exactly. The obj file contains the binary representation of the assembly code the compiler generated; the object file is then linked with other pre-built object files to form the final binary file.

Source > [Compiler] > Obj File

Program.obj--| > [Linker] > Program.exe
Std.obj -----|

Share this post


Link to post
Share on other sites
Quote:
Original post by Manip
The obj file contains the binary representation of the assembly code the compiler generated;


Actually the compiler is not required to generate intermediate assymbly code... (although its a good practice)

Share this post


Link to post
Share on other sites

This topic is 4868 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this