Am 02.09.2011 00:19, schrieb [email protected]:
> Hello,
>
> I have recently started using MSPGCC (4.4.3) and I'm new to this list.
>
> I facing difficulties with defined constants and getting "error:
> expected ‘)’ before ‘;’ token" error.
>
> I tried same code on gcc (x86) without the makefile and it compiles fine.
> If I replace test (OUTPUT); with test (1); it compiles fine also.
>
> Would could I be doing wrong?
>
> Any help would be appreciated.
>
> Thanks.
>
>
> -------main.c--------------
> #include <io.h>
> #include <string.h>
>
> #define OUTPUT 1;
> #define INPUT 0;
These are not constants, but macros.
Note that a preprocessor directive is _not_ terminated with a semicolon,
but with a line feed.
Fix the macros to NOT include the semicolon...
>
> void test(int data) {
> data=0; //do something
> }
>
> void main (void) {
> test (OUTPUT);
...else this will expand to "test (1;);" which isn't valid.
A decent C text book would tell you that.
Are you sure your x86 gcc didn't throw in the towel for not finding io.h?
I doubt your x86 test method, my gcc-for-x86 doesn't, if I hand it some
suitable io.h file in the first place; at any rate you need to add
-pedantic -std=c99 if you want to get anywhere that is at least remotely
related to acceptance tests. GCC default settings are unsuitable
because they default to a GNU-extended version and may not print all
diagnostics required by the standard.
--
M. Andree
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users