avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] How can I "#define" a string in the Makefile?


From: Dave Hansen
Subject: Re: [avr-gcc-list] How can I "#define" a string in the Makefile?
Date: Fri, 31 Oct 2003 14:22:56 -0500

From: Bob Paddock <address@hidden>
[...]
static CONST char FLASH Firmware_Prj_str[] PROGMEM = #FIRMWARE_REV_STR;

Stringizing did not work, but adding the backslashs did.

I suspect that's because it wasn't done correctly. Stringizing works only in the context of a macro.

Consider the following session:

--- begin included file ---
C:\Dave>type tstr.c
#define VERSION 1.23

#define Stringize(x) #x
#define Stringize_Value(x) Stringize(x)

char version_symbol[] = Stringize(VERSION);
char version_string[] = Stringize_Value(VERSION);
float version_value = VERSION;


C:\Dave>avr-gcc -E tstr.c
# 1 "tstr.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "tstr.c"





char version_symbol[] = "VERSION";
char version_string[] = "1.23";
float version_value = 1.23;

C:\Dave>
--- end included file ---

Regards,
  -=Dave

_________________________________________________________________
Cheer a special someone with a fun Halloween eCard from American Greetings! Go to http://www.msn.americangreetings.com/index_msn.pd?source=msne134



reply via email to

[Prev in Thread] Current Thread [Next in Thread]