g++ === ###### tags: `III` `CPP` `Linux Tools` ## Overview [source code -> assembly code -> object code -> machine code](https://stackoverflow.com/questions/466790/assembly-code-vs-machine-code-vs-object-code) ```graphviz digraph hierarchy { nodesep=3.0 bgcolor="transparent" node [color=Black,fontname=Courier] edge [style=solid, color=Black] preprocessor->compiler compiler->assembler assembler->linker } ``` * Preprocessing output: ``` cpp hello.cpp > hello.i ``` ``` g++ -E hello.cpp -o hello.i ``` * Compiling output: assembly code ``` g++ -S hello.cpp -o hello.s ``` * Assembling output: object code (binary file) is a portion of machine code ``` g++ -c hello.cpp -o hello.o ``` * Linking output: complete machine code ``` g++ hello.cpp -o hello -L./addlib -ladd ``` --- ## Compiling Time Compiling time includes compilation and linking. ### Linker - [gcc -L / -l option flags](https://www.rapidtables.com/code/linux/gcc/gcc-l.html) - [C/C++ 靜態連結庫(.a) 與 動態連結庫(.so)](https://www.itread01.com/content/1547725521.html?fbclid=IwAR1kuHnZ6iVReRuLp6CrRfsoB3E9-DItj5kj5NWcP9y9FmgnWzx8D-RLpv8) --- ## Execution Time Execution time includes loading and execution. ### Loader [linux 動態裝載動態庫 ldconfig,ld.so.conf, ld.so.cache](https://www.cntofu.com/book/46/linked_and_loader/linux_dong_tai_zhuang_zaidong_tai_ku_ldd__ldconfig.md)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up