I need to disable some code when run under the debugger.
So, I just imagine that doing:
{$IFNDEF DEBUG}
...
{$ENDIF}
However, the code inside the ifndef is executed in the debugger, makin it crash.
I have lazarus 0.9.29 & FPC 2.4.0
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The compiler directives that you mention are actually THAT: compiler directives, not debugging directives.
They relate to the compilation process, witch is completely separate from the debugging system.
What you have to do is:
You are confusing compilation and debugging and putting them in the same context.
They actually reside in complete separate contexts.
This could be due to the fact that you compile and debug under the same GUI system, but if you compile a program the only thing the debugger looks for is break points.
Hope it helps.
Edit: You can define it by a Simple {$DEFINE DEBUG} somewhere at the top of your Program/Unit or use the Lazarus Options pane to add it as a command line param.
To complete my answer.