2014-07-04 03:15 AM
Hello,
I know my problem is a little bit vague but I can't find a solution...I have this classic error when I compile:[cc] C:\Users\Jean\Desktop\PYRAMID CODE\src\IOs\MIDI\midi_in.c:196:51: error: expected ';', ',' or ')' before numeric constant
This error happends when I had a .h file in the midi_in.c file. This .h is already included in other .c files and causes no error.I'm sure I have no syntax error in all my files, and when I don't include this .h I have no error.Have you ever had this error when you add a .h and you have no syntax error?Thanks!2014-07-04 04:24 AM
Of course there is a syntax error ! It is likely to happen after macro expansion or maybe because of a double definition, or whatever else.
Let's try to find a solution. Are you using CooCox ? If yes, go in project configuration add -E flags to compiler misc controls, and build. Preferably remove others source files (Coocox compiles all in a single call to gcc), otherwise the output in the console will be very large. Cut'n paste the console output to a real editor (e.g. notepad++) and have a look to the preprocessed code, for sure you'll find the problem.2014-07-04 04:37 AM
Hi
''This error happends when I had a .h file in the midi_in.c file. This .h is already included in other .c files and causes no error.'' If the header include works in another file, then the problem is likely to be an include dependency. In the file where the include works, check to see what other includes there are above the one that is causing the error. Try including each of them in the file that does not compile. FYI I think the error is probably due to a type definition that is required by the offending .h file2014-07-04 06:26 AM
Hi Gonzales Laurent,
I use Coocox, I try to add -e to generate the preprocessed code, but I don't understand everything, the file is very large because my project have more than 100 files. For example, the .h file who generate the error is used by 10 files, that make the debug difficult... But I find that in the propocessed code the is no reference to the .c file that cause an error when I include the .h file. (I try a ctrl+F and there is nothing for ''midi.c'')Hi Sung chen,I try to include all the .h files that are above the working .c files: no changes...Note: all my .h files have something like#ifndef PADS_ENCODERS_MANAGER_H#define PADS_ENCODERS_MANAGER_H...#endif2014-07-04 06:44 AM
Ok I find the error, and it was so easy, just in front of my eyes... Sorry for this.
One of my variable in the .c file have the same name of a #define in the .h file. Because I have more than 200 #define I didn't catch it right away...Anyway thanks a lot I learn something!