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

CCSC.exe/CCSCOMPILE.exe passing in #defines as quoted string

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



Joined: 17 Jun 2019
Posts: 612
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

CCSC.exe/CCSCOMPILE.exe passing in #defines as quoted string
PostPosted: Thu Jan 30, 2025 4:57 pm     Reply with quote

When command line compiling, the manual says you can use

Code:
#xxx="yyy"


...to set a global define. We use this and it works, for lables, numbers and even single quoted characters:

Code:
#BOARD=CONTROL  #DEBUG=1  PARTITION='A'


But I had wanted to pass in something like this...

Code:
#if !defined(VERSION_METADATA)
#define VERSION_METADATA "-Bootloader"
#endif


But trying to do

Code:
#VERSION_METADATA="-OtherThing"


...does not work. It is passed in without quotes around it and just creates a compile error.

The manual also lists an alternative:

Code:
+Gxxx="yyy"


...but that does the same thing. Actually, it's a bit different. It I try to pass in "-Bootloader" using #, it effectively ends up like:

Code:
#define VERSION_METADATA -Bootloader


...with no quotes around it. Using the +GVERSION_METADATA="-Bootloader" will end up in UPPERCASE like:

Code:
#define VERSION_METADATA -BOOTLOADER


I have no idea why.

The usual escapes like \"String\" do not work.

Support said double quotes should work, but they do not.

Anyone figured out how to do this?
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
allenhuffman



Joined: 17 Jun 2019
Posts: 612
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 30, 2025 4:58 pm     Reply with quote

Also, order on the compile line seems to matter. You can have them before the BUILD=, but when I put one after it I got weird compiler errors.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
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