Force compile

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Force compile

Postby Dave » Tue Apr 12, 2005 5:57 pm

I would like to know if there is a way to force a .cpp file to always compile, even if no changes have been made. The reason is, I'm using the __DATE__ macro to record the date that the module was compiled, and I'd rather not have to remember to compile this .cpp file each time.


Force compile

Postby Dave » Tue Apr 12, 2005 5:59 pm

...other than choosing 'Build All' (takes way too long).

Postby savvyside » Wed Apr 13, 2005 5:32 am

this is "cheesy" but it works...

Set the DATE of the cpp file FAR into the future.

Make (and IDE) will always think that the obj is old.

I have done this, it works exactly the way you want.


Postby 2ffat » Mon Apr 18, 2005 10:39 am

Borland has included a program called "touch.exe," which is based upon the old Unix program with the same name. This program is non-GUI. You use it from the command prompt only. It is usually in the Borland bin directory. Type "touch" on the command line to see its options.

The purpose of this program is to change the date of source files to force the compiler or makefile to recompile the program.

BTW, I've also created a very simple GUI touch file, too.
James P. Cottingham

Look at me still talking
when there is science to do.
User avatar
Forum Mod
Forum Mod
Posts: 444
Joined: Wed Jun 23, 2004 7:07 am
Location: South Hill, VA

Return to Technical

Who is online

Users browsing this forum: No registered users and 18 guests