Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify a preprocessor directive in eclipse?

Tags:

c++

eclipse

How are preprocessor directives specified in eclipse for different configurations? For instance if I have multiple mains that should be run in different configurations and specify

#ifdef Problem1
//main func
#endif /*Problem1*/

Note that this is with managed makefiles

like image 995
Adam Avatar asked Sep 19 '10 19:09

Adam


People also ask

How do you write a preprocessor directive?

Preprocessing directives are lines in your program that start with # . The # is followed by an identifier that is the directive name. For example, #define is the directive that defines a macro. Whitespace is also allowed before and after the # .

What can the #define pre processor directive used for?

Preprocessor directives, such as #define and #ifdef , are typically used to make source programs easy to change and easy to compile in different execution environments. Directives in the source file tell the preprocessor to take specific actions.

What is preprocessor directive in Java?

A preprocessor is a program that works on the source before the compilation. As the name implies, the preprocessor prepares the source for compilation. The notion of the preprocessor has been there from the earliest times of programming languages.


1 Answers

The documentation points to "C/C++ Project Properties""Paths and Symbols""Symbols".

However, usually it is better to use different source files for different configurations/architectures/... instead of extensive preprocessor usage.

like image 171
Georg Fritzsche Avatar answered Sep 24 '22 08:09

Georg Fritzsche