gcc -ansi

I have C code that uses ANSI-style function declarations. Compiling it
with “cc”, “gcc” and “qcc” fails due to “parse errors.” When I try to
compile this code with “gcc -ansi” I get an error message that reads:

In file included from /usr/include/sys/neutrino.h:22,
from [filename.c]:[line number]:
/usr/include/sched.h:26: #error POSIX Scheduling needs P1003.1b-1993 or
later

In the code I have included the following:
#include <inout.h>
#include <sys/neutrino.h>
I installed C using the QNX package manager within the past week, so
I assume that I have the most recent version.

A line in sched.h gives me an error message because a variable called
“_EXT_POSIX1_199309” has not been defined. Should I be including
another include file in the code to provide a definition for this and
other variables? Is there a better way to compile ANSI code?

Thanks,
Kurt

-ansi doesn’t affect gcc’s ability to handle ANSI functions and prototypes.
All of our code uses ANSI style functions and prototypes, so I would assume
that there is a problem with your function.

Kurt Gunderson <kgunderson@igpp.ucllnl.org> wrote:

I have C code that uses ANSI-style function declarations. Compiling it
with “cc”, “gcc” and “qcc” fails due to “parse errors.” When I try to
compile this code with “gcc -ansi” I get an error message that reads:

In file included from /usr/include/sys/neutrino.h:22,
from [filename.c]:[line number]:
/usr/include/sched.h:26: #error POSIX Scheduling needs P1003.1b-1993 or
later

In the code I have included the following:
#include <inout.h
#include <sys/neutrino.h
I installed C using the QNX package manager within the past week, so
I assume that I have the most recent version.

A line in sched.h gives me an error message because a variable called
“_EXT_POSIX1_199309” has not been defined. Should I be including
another include file in the code to provide a definition for this and
other variables? Is there a better way to compile ANSI code?

Thanks,
Kurt


cburgess@qnx.com

Kurt Gunderson <kgunderson@igpp.ucllnl.org> wrote:

I have C code that uses ANSI-style function declarations. Compiling it
with “cc”, “gcc” and “qcc” fails due to “parse errors.” When I try to
compile this code with “gcc -ansi” I get an error message that reads:

We default to ANSI type function declarations, the gcc -ansi just makes
gcc far more strict about disallowing a bunch more stuff.

If you are getting parse errors, you’ve probably got a mistake in your
code – common causes of this are:
a missing ;
a missing closing "
a missing or mismatched { or }
a missing or mismatched ( or )

-David


QNX Training Services
dagibbs@qnx.com