I have the following code (IP addresses changed) in a Delphi 7 project.
const
{$IFNDEF DEBUG}
AUTHENTICATOR_DB_ADMIN_HOST = '123.456.789.12';
{$ELSE}
AUTHENTICATOR_DB_ADMIN_HOST = '127.0.0.1';
{$ENDIF}
Under project options:
In the above code example, the "DEBUG" symbol is not defined, so the IP address is set to 123.456.789.12
instead of 127.0.0.1
. What am I doing wrong?
This question is following on from Does Delphi's conditional compilation allow the defined symbols to contain values?
If you compile your project and there are no changes and the DCU is available on the path for the last non debug build then it will be used, causing this problem. Also make sure this unit is included in the uses clause of the DPR.
If you build the project it will force a recompile of all units added to the project.
I generally compile for syntax but always build for testing/deployment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With