1

Topic: Compilation of a part of the code only as Debug or only as Release

There is some code location: the pseudocode: a line N; a line N+1; a line N+2;//a line N+M; How to specify to the compiler, what this part of the code should be compiled only in the event that the program Debug-version becomes? And how to specify to the compiler, what this part of the code should be compiled only in the event that the program Release-version becomes?

2

Re: Compilation of a part of the code only as Debug or only as Release

Hello, RussianFellow, you wrote: RF> There is some code location: RF> the pseudocode: RF> RF> a line N; RF> a line N+1; RF> a line N+2; RF>//RF> a line N+M; RF> RF> How to specify to the compiler, what this part of the code should be compiled only in the event that the program Debug-version becomes? RF> and how to specify to the compiler, what this part of the code should be compiled only in the event that the program Release-version becomes? Preprocessor options - help you: #ifdef _DEBUG//the beginning of a macro of a preprocessor//... Here lines for compilation - ONLY In the Debug-version #else//... Here lines for compilation - ONLY In the Release-version #endif//the termination of a macro of a preprocessor Here are more detailed on this subject: https://msdn.microsoft.com/en-us/library/b0084kay.aspx http://www.cplusplus.com/doc/tutorial/preprocessor https://stackoverflow.com/questions/104 … sor-macros

3

Re: Compilation of a part of the code only as Debug or only as Release

RF> How to specify to the compiler, what this part of the code should be compiled only in the event that the program Debug-version becomes? RF> and how to specify to the compiler, what this part of the code should be compiled only in the event that the program Release-version becomes? It is called the conditional compilation. It is possible to google further.