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

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

Re: [avr-gcc-list] What does "error: expected expression before '/' toke


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] What does "error: expected expression before '/' token" really mean?
Date: Wed, 10 Sep 2014 09:05:42 +0200 (CEST)

Bob Paddock <address@hidden> 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. ;-)



reply via email to

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