#Pre-processing step

15 messages · Page 1 of 1 (latest)

forest forge
#

Hello, i newbie to C++, but started to learn from depths, can anyone recommend literature about building project steps? Like Pre-processing, making assembly and object files and linking them into executable file?

I created .cc file and do smt like that:

// main.cc
#include "source1.inl"

int main()
{
    std::cout << "Hello, World!\n";
    func1();
    func2();
    return 0;
}
// source1.inl
#include <iostream>

inline void func1(){
    std::cout << "func1() called\n";
}

inline void func2(){
    std::cout << "func2() called\n";
}

Then execute this commands:

g++ -E main.cc > main.i
g++ -S main.i
g++ -c main.s

After watching some videos and surfing the web i get into pre-processing, before compile our compiler do this step in which he extract all code from includes, removing comments and replace/remove preprocessed directives by C++ code. But is it do smt more? i want to know more about it blob_help

(Sorry for bad English)😅

golden cloak
#

normally you can just find that info on google really easilly also maybe first learn all your operations and other stuff, and then dive deeper in how they work under the hood it wil help you...

dense gyro
#

Dont know much so I might be wrong

forest forge
#

I already start to read book about it.

You can compile into executable file, or make step-by-step by the same compiler driver like gcc/g++/clang or smt like that.

Or you can make pre-processing by utility like cpp, then make compilation by the same compiler and you can do assembly using command as, after that u have object files which you can link by the same compiler driver or directly by low level linker using command ls but its a bit hard

dense gyro
forest forge
#

You mean if it not command line app but gui or smt like that?

wheat steppeBOT
#

@forest forge has reached level 1. GG!

ornate pier
#

data oriented design by richard fabian and the art of the assembly language (~750 pages) are good ones

#

also .cpp instead of .cc is just a slightly better practice and seperating between .h / .hpp / .inl / .ipp/ .tpp is not really neccesary but a good practice

wheat steppeBOT
#

@ornate pier has reached level 1. GG!

dense gyro
wheat steppeBOT
#

@dense gyro has reached level 1. GG!

forest forge
#

Cause i sitting on arch and using .cc but when i was using windows i used .cpp