Usage of extern in C/C++ Language

Declaration of External Variables Modern compilers generally adopt a file-based compilation method, which means that global variables defined in different files are mutually transparent during compilation. In other words, the visibility of global variables is limited to the internal scope of the file during compilation. Here is a simple example. Create a project containing two … Read more

Detailed Explanation of the C++ Compilation Process: From Source Code to Executable File

The C++ compilation process is the procedure of converting human-readable source code into a computer-executable binary file. This process can be divided into four core stages: preprocessing, compilation, assembly, and linking. Each stage has specific tasks that collectively ensure the code is correctly transformed into an executable program. 1. Preprocessing Preprocessing is the first stage … Read more

Detailed Explanation and Example Guide of Common GCC Compilation Options

This article is generated by Tencent Yuanbao, with content outline and verification provided by @Xiao Hui~ gcc [-c|-S|-E] [-std=standard] [-g] [-pg] [-Olevel] [-Wwarn…] [-Wpedantic] [-Idir…] [-Ldir…] [-Dmacro[=defn]…] [-Umacro] [-foption…] [-mmachine-option…] [-o outfile] [@file] infile… 1 Directory Options 1.1 Specifying Header File Search Path (-I) When header files are not in standard directories (such as <span>/usr/include</span>), … Read more

In-Depth Analysis of the GCC Compilation Process: From Preprocessing to Linking

This article is generated by Tencent Yuanbao, with content outline and verification provided by @Xiao Hui~ The compilation process of GCC (GNU Compiler Collection) is a complex multi-stage process that converts human-readable source code into machine-executable object code. This process mainly includes preprocessing, compilation (which can be further divided into five sub-stages), assembly, and linking. … Read more

The Compilation Process of C Language

The Compilation Process of C Language

The compilation and linking process of C language converts the source code of a C program we write into executable code that can run on hardware. This requires compilation and linking.The process is illustrated as follows: This article explains the work done during the compilation process of C language, which is helpful for understanding the … Read more

A Comprehensive Analysis of C++ Compilation and Linking: How to Resolve Those Frustrating ‘Undefined References’

A Comprehensive Analysis of C++ Compilation and Linking: How to Resolve Those Frustrating 'Undefined References'

Have you ever encountered these “mysterious” issues: clearly, both .cpp and .h files are written, compilation passes, but linking fails with the error message undefined reference to SomeFunction()? You have implemented merging with others’ projects, linking libraries, writing CMakeLists, and Makefiles, yet it always mysteriously fails once the project files are involved…

The Compilation Process of C Language

The Compilation Process of C Language

The compilation and linking process of C language converts the source code of a C program we write into executable code that can run on hardware, requiring compilation and linking.The process is illustrated as follows: This article explains the work done during the C language compilation process, which is helpful for understanding the workings of … Read more

Comprehensive English Pronunciation Rules: Linking, Weakening, Stress, Phrasing, Intonation

Comprehensive English Pronunciation Rules: Linking, Weakening, Stress, Phrasing, Intonation

In the process of oral expression, Chinese people value “clear pronunciation and distinct tones” and “pearls falling on a jade plate”. Therefore, when Chinese people speak, it is as if they are counting beans, clearly dropping one bean at a time.English, on the other hand, requires highlighting certain key words in a sentence while weakening … Read more

Theoretical Research on Self-assembled Phenobarbital and Acrylamide Systems

Theoretical Research on Self-assembled Phenobarbital and Acrylamide Systems

Theoretical Research on the Self-assembly System of Molecularly Imprinted Polymers Formed via Phenobarbital and Acrylamide WANG Guang-Yu (王光宇) LIU Jun-Bo (刘俊渤) TANG Shan-Shan (唐珊珊) CHANG Hai-Bo (常海波) JIN Rui-Fa (靳瑞发) Chinese J. Struct. Chem., 38, 1069 (2019) To prepare phenobarbital (PHN) molecularly imprinted polymers (MIPs) with higher adsorption and selectivity, this paper employed quantum chemical … Read more

Basic Concepts of C Language

Basic Concepts of C Language

1. Introduction to Hello World /* Program functionality: Display a string of characters on the PC screen */ #include <stdio.h> int main(void) { printf("Hello, World\n"); return 0; } In Linux, when using GCC to compile the Hello World program, the simplest command is (assuming the source code file is named main.c): $gcc main.c $./a.out Hello … Read more