Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to force compilation for a unit?

Status
Not open for further replies.

whosrdaddy

Vendor
Mar 11, 2003
4,231
BE
is there some compiler directive that would recompile a unit even if no code has been changed?

let me explain my (small) problem :

I have 2 projects : the main application and a configuration application.

the two apps are using a shared unit

in this unit I use conditional compiling, like this

Code:
unit u_sharedglobals;
...
{$IFDEF MAINAPP}
 STR_VERSION_FULL                = 'Professional version '+STR_VERSION_MAIN+' Release %s Build %s';
 INT_APPTYPE                     = TpProfessionalApp;
 {$ENDIF}    
                 
{$IFDEF CONFIGAPP}
 STR_NAME_CONFIGAPPLICATION      = STR_NAME_APPLICATION+' Configuration';
 STR_VERSION_FULL                = 'Version '+STR_VERSION_MAIN+' Release %s Build %s';
 INT_APPTYPE                     = TpConfigApp;
{$ENDIF}
...

when I open the main app project and compile, everything is ok. then I open the config app project and compile. now Delphi complains that it can't find the STR_NAME_CONFIGAPPLICATION constant.

for the moment I have 2 ways to solve the problem :

a)I modify the shared unit (like type a space somewhere) so that the modified flag is set
b)I delete the .dcu file

after doing one of thos 2 things delphi will recompile this unit and the error is gone.

I think there must be a better solution to this problem...


--------------------------------------
What You See Is What You Get
 

Yes. On the Project menu, there is an option to "Build XXXXX" where XXXXX is the name of your program. Or you could use the "Build All Projects" choice. The former one is sufficient for what you have described.

 
ah stupid, i'm a CTRL+F9 addict, will try to get used to SHIFT+F9. However this would rebuild the app every time, this ok for small projects, but nok for some of my large projs, also so my build number will increment, this is something I don't want...

anyway, thanks [2thumbsup]

--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top