Hi,
I have a big project working with an AT89C51SNDC with severals files ( *.c and *.h)
I don't understand why in this project, I have these errors messages :
error C141: syntax error near '90' error C281: illegal hex constant error C281: illegal hex constant error C281: illegal hex constant error C281: illegal hex constant error C281: illegal hex constant error C141: syntax error near 'A'
The file is an header file (gong_001.h) :
// *** Hex-value of : Gong_music_2Sec.mp3 code char MyArray1 [8000] = {0xFF, 0xFB, 0x18, 0x00, 0x00, 0x00, 0x00, 0xC2, 0x1D, 0x4C, 0x06, 0x1C, 0xE0, 0x02, 0x16, 0xA2, 0xE9, 0x90, 0xC1, 0x14, 0x00, 0x02, 0xEC, 0x45, 0x62, 0xBC, 0x17, 0x80, 0x08, 0x5F, 0x08, 0xAC, 0x57, 0x82, 0xF0, 0x01, 0xF0, 0x76, 0x26, 0xF1, 0x20, 0x4B, 0xF2, 0x6F, 0xE2, 0x40, 0x2C, 0xFC, 0x24, 0x12, 0xD3, 0xFC, 0xC0, 0x7E, 0x0F, 0xC9, 0xFF, 0xF9, 0x39, 0xC3, 0xFC, 0xA2, 0xFC, 0x9F, 0xB7, 0x90, 0x04, 0xFC, 0x08, 0x82, 0x1F, 0xE2, 0x80, 0x18, 0x06, 0x2F, 0xFA, 0x60, 0xFB, 0xFF, 0x94, 0x70, 0x3F, 0x00, 0x00, 0x07, 0xFF, 0xFE, 0x38, 0x94, 0xA7, 0xCC, 0x37, 0xF1, 0xEF, 0x04, 0x95, 0x8F, 0xF4, 0x42, 0x81, 0x58, 0xC8, 0x23, 0xC0, 0x00, 0x20, 0x00, 0x00, 0x8F, 0xFF, 0xF8, 0xE2, 0x52, 0x9F, 0x30, 0xDF, 0xC7, 0xBC, 0x12, 0x56, 0x49, 0xD4, 0x8A, 0x05, 0x63, 0x20, 0x8F, 0x00, 0x00, 0x9E, 0x96, 0x95, 0xE4, 0xD1, 0x52, 0x4D, 0x56, 0x01, 0xCD, 0x25, 0x4C, 0x41, 0x13, 0xFF, 0xFB, 0x18, 0x00, 0x07, 0x0F, 0xF0, 0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A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}; unsigned int nbrArr = 2; unsigned char MyArray3[1] = 0; unsigned char MyArray4[1] = 0; unsigned char MyArray5[1] = 0; unsigned char MyArray6[1] = 0; unsigned char MyArray7[1] = 0;
But in my project this big array (MyArray1 [8000]) is displayed only in 24 lines and so the lines is more longer than displayed here.
I have reduce (by placing .... ) the height of this array because here we are limited to 7000 caracters.
How can I do to avoid this errors messages ?
Thank you
"Amazing thing that I have seen is that when I compile the same project but with another computer ( more powerfull) I have not this errors..."
Is it just another computer, or is it also a different compiler?
Remember that every compiler and every editor has a finite limit to the number of characters that it can sope with in a single line - it may also be affected by the amount of memory in the PC.
Why are you making the lines so long anyhow? There is no reason to do so, and it is just asking for trouble like this!
Reduce each line to something sensible like about 80 characters!
"a finite limit to the number of characters that it can sope (sic) with in a single line"
Should, of course, be:
"a finite limit to the number of characters that it can cope with in a single line"
You've had this answered before:
http://www.keil.com/forum/docs/thread10231.asp
http://www.keil.com/support/man/docs/c51/c51_xd.htm
Oh yes, there is, if he reduced the line length the file might become legible and thus not "Real C".
Erik
Thanks I have this message in a window when started Keil for both computers the more powerfull computer and the other :
This file contains lines longerthan the 2048 charcacter maximum. The lines will be wrapped
I don't understand both software have the same version V2.40a and so I ask myself, why in one of the computers I have no errors ???
Which *.lst file must I read because I have severals?
"...both software have the same version V2.40a..."
What component of the software is at version 2.40a? IDE? Compiler? Editor? Linker?
Are all components the same?
Did you check for the typo I mentioned?
David.
A lot of people are using computer-generatted lists of hex data in their programs. Most people adjust their dump utility to emit 16-32 hex bytes/line.
That makes the code readable, and the source will be compileable with any valid C compiler, since it doesn't make assumptions about the longest line supported by the compiler.
Adding something like:
if ((i % 0x0f) == 0) printf("\n ");
to the dump program definitely helps the readability.
It also makes it possible to open the file in all standard editors, that you can print the source and that you can paste source code fragments to web forums without producing ridiculous page formattings.
"This file contains lines longer than the 2048 charcacter maximum."
The tools are telling you that they don't like lines longer than 2048 characters.
This is not unreasonalbe - 2048 is a lot of characters to have on a single line!
Other people have told you that such long lines do not make for readable, usable source code.
So, you have a choice:
1. Continue to try to force the tools to work with your excessively long lines;
2. Just don't use excessively long lines - thus avoiding this particular problem, and also the possibility of many other problems.
You choose!
...is that it's so nice when you stop!
"1. Continue to try to force the tools to work with your excessively long lines"
Given that you've been doing this without success for over 4 months now, don't you think it might be time to stop and try the other option?!
See: http://www.keil.com/forum/docs/thread10231.asp