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

#ifdef does not work

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



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

#ifdef does not work
PostPosted: Tue Oct 11, 2011 6:07 am     Reply with quote

Hi,
I am struggling with a basic statement:
Code:

//#define USE_MID_VARS 1
int test()
{
   #ifdef USE_MID_VARS
      return 1;
   #elif
      return 2;
   #endif
}

Throws "Expression must evaluate to a constant" error.
What is wrong with that?

Cheers, M.
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Tue Oct 11, 2011 6:17 am     Reply with quote

#ifdef is working just fine....

Use #else rather than #elif. #elif expects a condition, such as #elif defined BLAH. You need a plain #else.

RF Developer
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Tue Oct 11, 2011 6:18 am     Reply with quote

God, of course you are right.
I overlooked it.

Thanks
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