Jump to content
pgraham9999

How to fix "Warning'

Recommended Posts

I have a unit in a large project that does a zip backup of the data files at close.  The main zip procedure declares a variable 

 

Dir:TDirectory;

 

which is used to retrieve file names for the backup:

 

sl:=StrArray(Dir.GetFiles(SourceDir));

 

I then pass sl to the zip file.  It works correctly.  However, compile gives a warning "variable 'Dir' is declared but never used".  If I remove the variable, compile fails.  I don't like to leave warnings!  How can I remove this one?

Share this post


Link to post

That was too easy!  The following

 

 {$IFDEF MSWINDOWS}
  ReportMemoryLeaksOnShutdown := DebugHook <> 0;
 {$ENDIF}
 

gets warning "Symbol 'DebugHook' is specific to platform"  Didn't I just say that!
 

Share this post


Link to post
9 hours ago, pgraham9999 said:

That was too easy!  The following

 

 {$IFDEF MSWINDOWS}
  ReportMemoryLeaksOnShutdown := DebugHook <> 0;
 {$ENDIF}
 

gets warning "Symbol 'DebugHook' is specific to platform"  Didn't I just say that!
 

To remove that warning, go to menu, project, options, building, Delphi compiler, hints and warnings and expand output warnings and set platform symbol to false.

 

Share this post


Link to post
2 hours ago, FPiette said:

To remove that warning, go to menu, project, options, building, Delphi compiler, hints and warnings and expand output warnings and set platform symbol to false.

 

There are also directives for these warnings:

{$WARN UNIT_PLATFORM OFF}
{$WARN SYMBOL_PLATFORM OFF}

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×