Compilation Tools: GCC, GNU, MinGW, MSVC, Make, CMake, Ninja

Compilation Tools: GCC, GNU, MinGW, MSVC, Make, CMake, Ninja

1. Starting with Hello World: How Does a Program Become an Executable File? Let’s start with the simplest C program: On Linux, to run this code, we need to use GCC to turn it into a program that the machine can execute. This process consists of 4 steps: Preprocessing (<span>hello.c</span> → <span>hello.i</span>): Handling preprocessing directives … Read more

Directly Instructing GCC to Link a Library Statically

Directly Instructing GCC to Link a Library Statically

It feels strange to me to use <span>-Wl,-Bstatic</span> in order to tell <span>gcc</span> which libraries I want to link with statically. After all, I’m telling gcc directly all other information about linking with libraries (<span>-Ldir, -llibname</span>). Is it possible to tell the <span>gcc</span> driver directly which libraries should be linked statically? Clarification: I know that … Read more