CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Pre-Defined Identifier for compiler version?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
andy5056



Joined: 22 Nov 2009
Posts: 5
Location: Thomasboro, IL

View user's profile Send private message

Pre-Defined Identifier for compiler version?
PostPosted: Fri Jun 25, 2010 8:04 am     Reply with quote

The compiler manual lists several pre-defined pre-processor identifiers like __DATE__ and __TIME__ that can be included in the C source code.

Is there a pre-defined identifier for the compiler version number? If not, is there another to determine the compiler version number automatically?

I am looking for a way to embed the compiler version number in the source code without having to manually update a constant or string value.

Andrew
tesla80



Joined: 23 May 2007
Posts: 81

View user's profile Send private message

PostPosted: Fri Jun 25, 2010 10:31 am     Reply with quote

Hi, you can use getenv() function for that.

Quote:
value = getenv (cstring);
VERSION
Returns the compiler version as a float

VERSION_STRING
Returns the compiler version as a string


Code:
#IF  getenv("VERSION")<3.050

   #ERROR  Compiler version too old

#ENDIF
andy5056



Joined: 22 Nov 2009
Posts: 5
Location: Thomasboro, IL

View user's profile Send private message

PostPosted: Thu Jul 01, 2010 10:27 am     Reply with quote

Thanks! That is just what I was looking for.

Andrew
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group