Directives for the compiler – C++

Directives for the compiler – C++

Compiler control directives are marked with # and most often precede the program.

The include directive

Directive include gives the name of the module header file, whose content is included in the program. Standard modules containing typical language functions used in the program can be included (the name is placed in angle brackets <>) or own modules (the name is placed between quotation marks ” “):

# include <stdio.h> //standard module
# include “dictionary h” // own module

Define directive

Directive define declares a text constant replaced in the program text with a string representing the value of the constant:

# define steName

np. constant n:

# define n 100

Conditional compilation directive ifndef endif

Conditional compilation directive ifndef endif conditionally compiles a module, if the constant used in the condition is undefined, and then the directive define defines a constant. Otherwise, compilation does not take place. Between ifndef a endif the content of the header module is placed:

# ifndef stal_modulu

# define stala_modulu


# endif

Leave a Reply

Your email address will not be published. Required fields are marked *