Menu

Basics of Using the Preprocessor
📰

Basics of Using the Preprocessor

Planet Qt·4 days ago
#ECRZwVwF
#planetqt#qt#include#error#pragma
Long article (1155 words) — no AI summary yet.
Reading 0:00
15s threshold

Anyone who has ever read a piece of C source code has seen them—the preprocessor directives. For example, you can find include directives (#include) at the beginning of most source files. The preprocessor is a system that rewrites the source before the actual compiler sees it. Clearly, this is a very powerful tool—the downside is that you could accidentally shoot yourself in the foot.

In this article we will introduce the preprocessor and covered the basics, including object- and function-like macros, the include directive, conditional compilation, and end with the two special directives #error and #pragma .

The #include directive

The most straight-forward preprocessor directive is #include .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.