Thread: Include Compile Info

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    1

    Include Compile Info

    I've written a program that is currently going through changes fairly often. I need a way to verify that that application being used is my latest (and hopefully greatest) version.

    I've tried adding a #define REV statement that I increment with each compile, but I start punching out code, hit the compile button, to some testing find something that needs changing and ultimately forget to increment my REV define. So, I often end up with two versions that both report the same version level.

    I would like to have the compiler grab the systems date/time when I compile my application, and then be able to access this information within my application.
    (I really don't care if date/time are used. I just need a unique identifior that is created when the program is compiled and doesn't rely on me remembering to update a number)

    Is there anyway to do this using the standard C library?

    FYI - I've written the application in LabWindows (CVI) and according to National Instruments there is no tool in LabWindows inferface that will do this.

    Any help or suggestions would be appreciated.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Are you using any kind of version control, like RCS, CVS, Subversion ?

    How about this, which tells you when it was compiled
    Code:
    #include<stdio.h>
    
    char built_on[] = __DATE__ " " __TIME__;
    
    int main ( ) {
        printf("&#37;s\n", built_on );
        return 0;
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  2. Multiple include problem
    By VirtualAce in forum Game Programming
    Replies: 13
    Last Post: 02-04-2006, 06:09 PM
  3. Why am I getting these errors??
    By maxthecat in forum Windows Programming
    Replies: 3
    Last Post: 02-03-2006, 01:00 PM
  4. Read and write hanging
    By zee in forum C Programming
    Replies: 8
    Last Post: 08-03-2004, 11:19 PM
  5. Dialog Will not appear?
    By curlious in forum Windows Programming
    Replies: 1
    Last Post: 10-20-2003, 10:32 AM