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 support@ccsinfo.com

Need help with getenv()

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







Need help with getenv()
PostPosted: Thu Sep 11, 2008 10:22 am     Reply with quote

Code:
#DEFINE DEV getenv("DEVICE")

#IF DEV == "PIC10F200"
#DEFINE M 0
#ELIF DEV == "PIC12F508"
#DEFINE M 1
#ENDIF

gives me.........

*** Error 27 "J:\Electronics\101\Serial\10F200\mcproc.h" Line 5(11,13): Expression must evaluate to a constant

I'm simply trying to create a central header that will encapsulate all
additional device-specific #defines and whatnot that are not included in
the default headers. It seems as if i cannot call getenv("device") more
than once per source file.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 11, 2008 12:26 pm     Reply with quote

The first line needs parentheses around it. Example:
Code:
#define DEV (getenv("DEVICE"))
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