Re: What does "error: expected expression before '/' token" really mean?

[email protected] (Joerg Wunsch)
Newsgroups gmane.comp.hardware.avr.gcc
Organization Private BSD site, Dresden
Message-ID <[email protected]>
Bob Paddock <[email protected]> wrote:

> "error: expected expression before '/' token"

You could try running only the preprocessing step (-E), and have
a look at the output.

> -DLOGO_TEXT_POSITION_X=SCRN_LEFT+1U
> -DLOGO_TEXT_POSITION_Y=SCRN_TOP+20U
> -DALARM_SET_POINT_MAX=15*1

Quote these, like:

-DLOGO_TEXT_POSITION_X="SCRN_LEFT+1U"
-DLOGO_TEXT_POSITION_Y="SCRN_TOP+20U"
-DALARM_SET_POINT_MAX="15*1"

The "+" and "*" characters are special to the shell.  They are
so-called globbing characters, and the shell replaces them by
matching filenames *before* executing the (avr-gcc) command.

> -DNEW_BUILDNUMBER=911
> -DNEW_BUILDNUMBER_TEXT=\"911\"

Btw., the latter can be derived from the former, through the
"stringify" operator "#".

Supposed a file foo.c like:

#define STR_(x) #x
#define STR(x) STR_(x)

NEW_BUILDNUMBER
STR(NEW_BUILDNUMBER)

Then calling avr-gcc -E -DNEW_BUILDNUMBER=42 foo.c yields:

# 1 "foo.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "foo.c"



42
"42"

-- 
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.