User forums > Using Code::Blocks

#define error in CodeBlocks

(1/2) > >>

I am running Code::Blocks version 20.03 on Windows 10 (22H2)
 The compiler I use is GNU GCC Compiler.

Anytime, whenever I use #define to define a constant, I am always greeted with the following error:
error: expected ';' , ',' or ')' before numeric constant.  I have never encountered this error before when using #define and don't know what it means.
what I wrote is: #define ARRAY_SIZE 5.
Any help anyone can offer would be greatly appreciated.

Thank you.

Miguel Gimenez:
Why do you open a new thread with the same question?. Follow stahta01's advice in the original thread.

I did. It said to specify the build of codeblocks you're using, your OS details, etc. So I did that, to the best of my ability at least.  It also had stuff about how to bracket code so that it was easily distinguishable from other text, but that doesn't apply here. I figured it was best to open a new one rather than modify the original as people would be more likely to see it, dismiss it because it was missing info and not come back to it.

Since you failed to post a full build log, I have decided you no longer want help from me.

Edit2: See also,25519.msg173716.html#msg173716

Good Bye.

Tim S.

PsychadelicGumballMachine, start troubleshooting from the basics. Create and run a brand new test C project. After confirming that it compiles and run, in the 'helloWorld' code that was created automatically insert the #define and recompile. The issue should not occur, which makes the environment or particularly the affected project the prime suspect. The issue you report is not reproducible
To cover every angle, in case the basic 'helloWorld' code does have the issue when you add the #define, then please follow previous advise and provide the requested logs to the original thread. Opening a new thread with the same question is not right, a breach of  protocol; lesson learned we hope.


[0] Message Index

[#] Next page

Go to full version