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

problem with getenv("DEVICE)

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



Joined: 11 Sep 2007
Posts: 18

View user's profile Send private message

problem with getenv("DEVICE)
PostPosted: Thu Dec 20, 2007 4:25 pm     Reply with quote

I'm using the August '07 version of PCH. Compiling the following test program

[code]
#define __USB_PIC_PERIF__ 1

//#include <18F4450.h>
#include <18F4550.h>

#if getenv("DEVICE")=="PIC18F4450"
#endif

#if getenv("DEVICE")=="PIC18F4550"
#endif
[code]

Fails with the following error.

[code]
Executing: "C:\Program Files\PICC18\Ccsc.exe" "test.c" +FH +DF +LN +T -A +M +Z +Y=9 +EA
*** Error 27 "test.c" Line 9(21,23): Expression must evaluate to a constant
*** Error 48 "test.c" Line 10(24,34): Expecting a (
2 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Thu Dec 20 14:15:39 2007
[/code]

Any sort of small changes, different device, switching order etc. result in the same error on the second usage of getenv("DEVICE").

Any help appreciated[/code]
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 20, 2007 4:37 pm     Reply with quote

"August '07" is not a version number. Post the real version number.
Do a compilation that doesn't result in an error. Then look in the
project directory and find the .LST file. The version number is given
near the start of the file. It's a number such as 3.249, 4.013, 4.064, etc.
Post it.
Ramey



Joined: 11 Sep 2007
Posts: 18

View user's profile Send private message

version #
PostPosted: Thu Dec 20, 2007 5:22 pm     Reply with quote

pch Version 4.055
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 20, 2007 5:33 pm     Reply with quote

Put parentheses around each statement, as shown in bold below:
Quote:
#if (getenv("DEVICE")=="PIC18F4450")
#endif

#if (getenv("DEVICE")=="PIC18F4550")
#endif
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Thu Dec 20, 2007 6:54 pm     Reply with quote

I reported this to ccs on Tuesday - they said it's fixed in the next release Smile

Ken
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