Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#263104 - 22/08/2005 14:56 Line concatenation in define
Andre81
new poster

Registered: 13/08/2005
Posts: 28
Loc: Germany
I've included some headers now and i get a parser error everywhere where i've used line concatenation in a define.

It compiles fine with VC++ but not with gcc. I know that this looks like a newbie question, but i really don't understand why i get a parse error.

Code:

#define x \
10


Top
#263105 - 22/08/2005 15:07 Re: Line concatenation in define [Re: Andre81]
Andre81
new poster

Registered: 13/08/2005
Posts: 28
Loc: Germany
#define xxxxx \
blah


warning: blah declared as function returning a function


Top
#263106 - 22/08/2005 15:12 Re: Line concatenation in define [Re: Andre81]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4180
Loc: Cambridge, England
Quote:
Code:
#define x \
10


Should work fine. Is there any whitespace after the backslash? If you're using a Unix gcc, that may include CR.

Peter

Top
#263107 - 22/08/2005 15:56 Re: Line concatenation in define [Re: peter]
Andre81
new poster

Registered: 13/08/2005
Posts: 28
Loc: Germany
In Antwort auf:
Is there any whitespace after the backslash? If you're using a Unix gcc, that may include CR.


No, just the required whitespace in front of the backslash. But i am using Visual Studio under Windows to edit my files, maybe gcc doesn't like the newline?

Top
#263108 - 22/08/2005 16:03 Re: Line concatenation in define [Re: Andre81]
Andre81
new poster

Registered: 13/08/2005
Posts: 28
Loc: Germany
Ok, i've checked some other code for the empeg in the hex editor and my code, my code has a 0x0D 0x0A as a newline while the other had just a 0x0A.

After i've removed the 0x0D the file compiles.

Seems like i have a problem now

Top
#263109 - 22/08/2005 17:02 Re: Line concatenation in define [Re: Andre81]
Attack
addict

Registered: 01/03/2002
Posts: 599
Loc: Florida
Just get a dos2unix program. I know UltraEdit32 has it built in.

Top
#263110 - 22/08/2005 17:02 Re: Line concatenation in define [Re: Andre81]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Windows uses \r\n for EOLs and Unix uses just \n. The fact that you're editing Unix text files with a Windows text editor is 100% the problem. You can fix them after the fact with the nearly ubiquitous dos2unix command.
_________________________
Bitt Faulk

Top
#263111 - 24/08/2005 22:00 Re: Line concatenation in define [Re: Attack]
Andre81
new poster

Registered: 13/08/2005
Posts: 28
Loc: Germany
Here is a plug in for the Visual Studio that allows to set the end of line: http://www.codeguru.com/Cpp/V-S/devstudio_macros/textoperations/article.php/c3161/

Top