How to force recompile of one source file for every build?

context: Win2K -- VC++6 -- MFC -- SDI

I want to have a build-date in my program and I'd like this to be
automatically updated with every build.  It's trivial to create a data item
        char    BuildDate[32] = __DATE__;
which the preprocessor modifies at compile-time to contain the current date.

But I can't figure out how to make VC automatically compile the source file
that compiles this with every build.  I've looked at the Project | Settings
property sheets but if it's there it's not easy to see.

    TIA
        Norm


0
ndrez (136)
7/11/2003 7:53:32 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
595 Views

Similar Articles

[PageSpeed] 41

Use custom build step and delete all the relevant obj/exe/dll files from the
output folder(s).

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"Norm Dresner" <ndrez@att.net> wrote in message
news:0BEPa.50291$0v4.3401047@bgtnsc04-news.ops.worldnet.att.net...
> context: Win2K -- VC++6 -- MFC -- SDI
>
> I want to have a build-date in my program and I'd like this to be
> automatically updated with every build.  It's trivial to create a data
item
>         char    BuildDate[32] = __DATE__;
> which the preprocessor modifies at compile-time to contain the current
date.
>
> But I can't figure out how to make VC automatically compile the source
file
> that compiles this with every build.  I've looked at the Project |
Settings
> property sheets but if it's there it's not easy to see.
>
>     TIA
>         Norm
>
>


0
ajaykalra (6842)
7/11/2003 8:20:31 PM
Norm,

i do exactly this same sort of thing.  i have a "set modified time"
console utility app that i run (passing the path to the target .cpp
file) during the post_link step -- it just updates the last modified
time to the current time after the build to make sure that my build date
file is "out of date" at the next build.

regards
roy fine


/*
************************************************************************
*/
int main(int argc, char* argv[]){
printf("\nTouchMe Version 1.0a, 22 Feb 02, Software Systems, Inc.");
HANDLE hFile;
FILETIME fileTime;
SYSTEMTIME sysTime;
hFile = ::CreateFile(argv[1],GENERIC_ALL,0,NULL,OPEN_EXISTING,0,0);
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime, &fileTime);
SetFileTime(hFile,NULL,NULL, &fileTime);
CloseHandle(hFile);
printf("\nLast Modified Time for %s\nset to current
date/time\n",argv[1]);
return 0;
}

/*
************************************************************************
*/

"Norm Dresner" <ndrez@att.net> wrote in message
news:0BEPa.50291$0v4.3401047@bgtnsc04-news.ops.worldnet.att.net...
> context: Win2K -- VC++6 -- MFC -- SDI
>
> I want to have a build-date in my program and I'd like this to be
> automatically updated with every build.  It's trivial to create a data
item
>         char    BuildDate[32] = __DATE__;
> which the preprocessor modifies at compile-time to contain the current
date.
>
> But I can't figure out how to make VC automatically compile the source
file
> that compiles this with every build.  I've looked at the Project |
Settings
> property sheets but if it's there it's not easy to see.
>
>     TIA
>         Norm
>
>

0
rlfine5330 (47)
7/11/2003 9:00:28 PM
Create a batch file with the following line in it -
echo. >> xyz.cpp

This will add a blank line to the end of your file (thus changing the date).
The next time you compile your project, this file will be recompiled.

Use Windows Task Scheduler to run this batch file every night at 12:01 am.
Your cpp should recompile during your first compile each day.

-Kanon




"Norm Dresner" <ndrez@att.net> wrote in message
news:0BEPa.50291$0v4.3401047@bgtnsc04-news.ops.worldnet.att.net...
> context: Win2K -- VC++6 -- MFC -- SDI
>
> I want to have a build-date in my program and I'd like this to be
> automatically updated with every build.  It's trivial to create a data
item
>         char    BuildDate[32] = __DATE__;
> which the preprocessor modifies at compile-time to contain the current
date.
>
> But I can't figure out how to make VC automatically compile the source
file
> that compiles this with every build.  I've looked at the Project |
Settings
> property sheets but if it's there it's not easy to see.
>
>     TIA
>         Norm
>
>


0
Kanonw (36)
7/11/2003 9:28:27 PM
"Norm Dresner" <ndrez@att.net> escribi� en el mensaje
news:0BEPa.50291$0v4.3401047@bgtnsc04-news.ops.worldnet.att.net...
> context: Win2K -- VC++6 -- MFC -- SDI
>
> I want to have a build-date in my program and I'd like this to be
> automatically updated with every build.  It's trivial to create a data
item
>         char    BuildDate[32] = __DATE__;
> which the preprocessor modifies at compile-time to contain the current
date.
>
> But I can't figure out how to make VC automatically compile the source
file
> that compiles this with every build.  I've looked at the Project |
Settings
> property sheets but if it's there it's not easy to see.

Just another idea: define a post-build step (Project - Settings - Post-build
step) with a command that deletes the .obj corresponding to that .cpp

--
jlr



0
jlr (33)
7/12/2003 2:03:25 AM
"Jos� Lamas R�os" <jlr@artech.com.uy> wrote in message
news:OhjzFjBSDHA.1804@TK2MSFTNGP11.phx.gbl...
> "Norm Dresner" <ndrez@att.net> escribi� en el mensaje
> news:0BEPa.50291$0v4.3401047@bgtnsc04-news.ops.worldnet.att.net...
> >
        [SNIP]
> > But I can't figure out how to make VC automatically compile the source
> > file with every build.  I've looked at the Project |Settings property
sheets
>> but if it's there it's not easy to see.
>
> Just another idea: define a post-build step (Project - Settings -
Post-build
> step) with a command that deletes the .obj corresponding to that .cpp

I like this suggestion.  A non-destructive way to do it is to 'touch' the
..cpp in the post-build.

Thanks to all who suggesting things that would work

    Norm


0
ndrez (136)
7/12/2003 6:01:09 AM
Reply:

Similar Artilces:

Export or Print multiple reports from one Access Report by Group
I have a sales report that is grouped by Salesperson. Each salesperson has multiple pages of the report and I need to either print it or export it to PDF as individual reports for each salesperson. Is there a way to export/print the report into seperate reports for each Salesperson? Thanks. I am pretty new to Access, but I have figured out how to get the report in the structure I want it. I just can't get the information out of the program in the format. I can print as one PDF document and then go and cut that up in Adobe, but I wanted to see if Access could do it for me and save ...

backing up files
Does anyone know if it is possible to back up my money files to a CD RW disc. Please e-mail an answer to me. Why should I email you an answer when the answer to this question has already been posted three or four times already this week? Please read the posts. "John Koegel" <bigjohn1016@mns.com> wrote in message news:044501c348bf$62e760b0$a001280a@phx.gbl... > Does anyone know if it is possible to back up my money > files to a CD RW disc. Please e-mail an answer to me. ...

PDF file #7
I have Publisher 2002 and would like to insert a .pdf file into a document I am working on. How do / Can I do this? Many thanks, Ger ...

No date fields appear when exporting/importing CSV file?
Hello All, I need to convert some legacy emails from another system to a format that can be read by Outlook. The preferred format is CSV text, which we plan to import into Outlook. I noticed when playing with the export/import that the following seem to be the standard fields that get exported into an Outlook generated CSV file: "Subject", "Body (text)", "From: (Name)", "From: (Address)", "From: (Type)", "To:(Name)", "To: (Address)", "To: (Type)", "CC: (Name)", "CC: (Address)", "CC: (...

Control Source for text box on a report
I have a table with only 2 fields. One is the name of Department and the other is the total number of positions in that department. On my report I have a label for every department. Next to that label I have a text box that counts every record on my report for each department. Next to that I want to add another text box that contains the corresponding number in the table for that department. How can I easily do this? Thank You, CEV I forgot to mention that I would also like to add yet another text box that adds the total of all the other text boxes that contain the total number of ...

Exchange/Outlook 2003
In an effort to make sure we never reach the 16GB threshold for the SBS 2003 Exchange Info Store, I'm looking to setup a GPO to give everyone consistent AutoArchive settings as well as a common location for the PST file. I have already downloaded the Office Administrative Templates for Outlook 2003, so I already have found the settings I want to modify and have made the changes, I just haven't made them live on the domain yet. My thoughts to date: * create two GPOs, one for the PST location, one for the autoarchive settings themselves * set PST location to local drive, or common netw...

How do I list more opened Word docs under the File menu
Word 2003 displays the last 4 Word files opened on clicking the File menu. I would like to increase this to about 20. Can this be done, and if so, how? In Word 2003, the maximum number that can be shown is 9 and it can be set via Tools>Options>General -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Wellington" <Wellington@discussions.microsoft.com> wrote in message news:A9B8C9D4-4F78-4A92-94C6-8DC0D41388...

Code stops for one user, like it has a breakpoint
I have a user where the code stops at this line like it has a breakpoint, but it doesn't. There is no issue on my system. myUserName = Environ("USERNAME") When the user presses F5, it continues to run. Has anyone seen this and what do I need it to do to run without stopping? Thanks, Barb Reinhardt Barb The only thing that stikes me about this is the case. I run several files in here that are used by about 50 people every days. Environ("UserName") has never given us a problem (note the use of Proper Case rather than your UPPER). -- ...

Error in coding going from one computer to another.
I have a database that works great on my laptop where it was created. I placed it on our server but I am the only one who can access and work with it. Everyone else gets an error for the String. Any suggestions? This is the actual error: Private Sub Combo230_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "[Quality Plan ID] = " & Str(Nz(Me![Combo230], 0)) If Not rs.EOF Then Me.Bookmark = rs.Bookmark End Sub where ther error is at 'Str'. Thank you Dyper How about telling us t...

data error while opening files
when i open excel or word existing file i getting contents as "DATAError [47 0F 94 93 F4 K5]" instead of my saved data. pls help me solving. My all word & excel files are have same problem. ...

Cannot open Publisher File
I'm using Publisher 2003 and have a 100 MB (66 MB Compressed) publisher file that consitently hangs up publisher when trying to open it. Once in a while, the first page will load, but when you try to switch to another page, the program hangs up again. I've tried several PCs to open the file with including a P4 file server with 2 GB of RAM. nothing seems to make a difference. I can tell through the Task Manager that the app is doing some sort of processor work, but no disk access is being performed. I tried opening the file in Safe Mode and it make some slight improvements w...

integrate my vendor/supplier files from RMS and SBF into Outlook
I want to be able to see my vendor/supplier the same info in outlook, RMS and SBF I hate having to rekey the same information over and over. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-...

Support for more than one Sch. C?
Does Money Small Business 2004 Support more than one Schedule C? I have 2 sole proprietorships and my wife is a Self Employed Realtor sole proprietor. We file Jointly and need to keep track of income and expenses for at least 2 and preferably 3 or more Schedule C's plus all our personal expenses. If Money does not support multiple schedule C's directly, does any one know how we can do this better than the following? We are presently using Quicken Premier Home and Business 2004 with a different number series for each business but they are all connected to the same Sch C cat...

Lost File #2
I have accidently saved over a publisher file and lost all my work. I am aware that I have temp files that may have the data in it but I cannot access any of them. I get an error message saying it is locked or in use by another person but they are not. Can anyone help >-----Original Message----- >I have accidently saved over a publisher file and lost all my work. I am >aware that I have temp files that may have the data in it but I cannot access >any of them. I get an error message saying it is locked or in use by another >person but they are not. > >Can anyon...

Parsing a space delimited file into segments
I have a space delimited file that contains address information. Is there a way to parse each record so that I parse the records into specific portions (Company Name is field 1, Street Address is field 2, etc.)? Using the space as a delimiter doesn't help in this instance because every word is obviously separated by a space. Any help with this would be appreciated. Thanks. hi, you could use the fixed width option but unless all of the data is the same width that could cause a serious problem. i don't know how much data you have but you may have to do it in groups or 1 line a...

3 pst files
I want to have 3 pst files on my Outlook 2003 setup. Is this possible? I have the pst file that I work now and 2 others which are pst files from an old laptop which I want just to be there as separate. How can I do it and shall I do Import or is there any other way. thanks Virginia Don't use the import feature. Simply reconnect the pst-files via; File-> Open-> Outlook Data File... You can place the pst-file in a location that is convenient to you. For instance in a sub folder of your My Documents folder called "Outlook". -- Robert Sparnaaij [MVP-Out...

Publisher 98 Web Page Building
I am in Year 9 at school, and my class were set the task of making a single Web page about quite a famous author and playwright called R. C. Sherriff (he wrote Journey's End - a play about trench life in World War One - which was a West End hit). The computers in our I.T. Department currently run Microsoft Windows NT 4.0 with various service packs and updates. The system setup is quite common to the West Midlands schools, specifically those in the Telford & Wrekin area of the UK. Anyway, each computer has a preloaded version of Office 97 and Publisher 98. I am quite experienced with ...

Can't open any .exe files
If I click on any programs it pops up and tells me that there is no association. I know how to association a file extension normally. If I click on Excel it gives me the error. Yet if I click on an Excel file then it will open the file. If I click on Notepad gives me the association error yet again if I click on a file saved in Notepad it opens that file. I tried to run System Restore but I get the same error. The exact error message is : This file does not have a program associated with it for performing this Acton. Create an association in the Folder Options control Pane...

Skipping a source record with IM
Hi all I'm using IM with GP10 to bring over PO trasactions. I've got it all working except for on thing: if a source record (from the foreign system) is an existing PO and has a Status of "D" (deleted), I need to skip that doc. I tried the following in the before document: If SourceFields("POHeader.Status") = "D" Then 'Create a SQL UPDATE statement to update the POStatus to cancelled sSQL = "UPDATE " & sDatabaseName & ".dbo.POP10100 " sSQL = sSQL & " SET POStatus = 6" sSQL = sSQL & &quo...

add new incident from external source
when i am try to add new records to incident table from external sytem i recived on error "The parameter is incorrect" on case screen , i insert the record directly to DB, my question is how can i import records to incident table without use the migration framework someone have maybe any idea i to resolved this case thank you tal Tal, You should not enter data directly in the database. Instead, create a small application which stores the new incidents by using the SDK. Using the SDK to enter data into the database is quite easy and you will get normal error messages i...

unknown cab file required
I just installed Project 2003 and immediately ran the update routine. Office Update tells me that it has SP1 for Project and some new junk mail filters for Outlook 2003. I tell it to download both patches. Download proceeds with no problem. Installation tells me that it cannot find a file called SKU111.CAB. I search all local hard disks - no file. I search the Project disk - no file. I search the Office 2003 disk - no file. I even searched the Publisher 2003 disk (which is not installed). I can account for an SKU13B and an SKU119, but no SKU111. I search all of Microsoft.com - nothing e...

error opening excel file
hi! i cannot open this excel file, an microsoft visual basic window appear saying "An error occur while loading 'Sheet32111111111111111111111111'. Do you want to continue loading the project?" i click yes, microsoft window appear and asking if i want to update this workbook? then i click no a Program Error window appear saying " An error log is being created" what happen to the excel file? the excel file is only 2.6Mb There is a bug in xl97 (fixed in xl2k, IIRC) that allowed worksheet codenames to get too long. I _think_ that newer versions of excel will open...

Move one cell to another
I need to copy the content of one cell to another when a different cell is greater than 239. Example: if N20 is greater than R20(value 239) then copy the content of B20 to S20. OR A method to delete all records that have a value less than 240 in column N. Any help would be appreciated. Thanks, Mike -- Mike Formula in S20: =IF(N20>R20,B20,"") best wishes -- Bernard Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme "Mike" <Mike@discussions.microsoft.com> wrote in message news:219BB2BA-6CEF-4E74-AB00-DCFCEB84BAED@micro...

Income / expense / net comparison over 4 years in one chart
How do I create a chart that compares the Income, Expense and Net Income across multiple years (4-5 years)? By "Income" do you really mean net revenue? Due to the potential changes in magnitude of gross revenue, net revenue, total expense, and net operating income, I would suggest creating three seperate graphs. The first graph would show net revenue, the second total expense, and the last net operating income. This approach would be much simpler for you to create as well as for the viewer to understand than trying to combine all three components. I would use a simple ba...

Charts different data sources
Hi, My problem. I have a workbook with more than 50 worksheets. All the worksheet have the same structure and each I would like to embed 3 different chart, one for income, other for cost and another for Ebitda. I would like to make a template for each chart and copy for the others worksheet. Questions: 1 - How can I make this dynamic as I would like to choose hom many months I would like to show in each chart? 2 - How I keep the reference for the data source in each worksheet? I tried to use the functions offset, 3d range and others functions but I could�t make them work. Can somebo...