View previous topic :: View next topic |
Author |
Message |
Ramey
Joined: 11 Sep 2007 Posts: 18
|
problem with getenv("DEVICE) |
Posted: Thu Dec 20, 2007 4:25 pm |
|
|
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
|
|
Posted: Thu Dec 20, 2007 4:37 pm |
|
|
"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
|
version # |
Posted: Thu Dec 20, 2007 5:22 pm |
|
|
pch Version 4.055 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 20, 2007 5:33 pm |
|
|
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
|
|
Posted: Thu Dec 20, 2007 6:54 pm |
|
|
I reported this to ccs on Tuesday - they said it's fixed in the next release
Ken |
|
|
|