C Preprocessor: Expected Declaration Specifiers
Ryan Slominski
rjslom@cs.wm.edu
Mon Feb 5 03:44:00 GMT 2007
Michael,
I am compiling user code. I did have kernel code, but I compiled
that separately and with no problems. Surprisingly, the user code is
what is giving me problems!
Ryan
On 2/4/07, Michael Eager <eager@eagercon.com> wrote:
> Are you trying to compile parts of Linux or a driver?
> If so, you should be using "make bzImage" or something
> similar, rather than trying to compile outside of the
> kernel framework. The makefile will add all of the
> appropriate include directories.
>
> Ryan Slominski wrote:
> > Michael,
> > Thanks for you response. I used the -E -dD switch on both the
> > Ubuntu and Debian distribution to compare. On the Debian the macro is
> > being expanded as expected. On the Ubuntu the macro doesn't get
> > expanded at all.
> > My understanding is that gcc first looks under /usr/local/include
> > and then /usr/include for header files. On the Debian the macro
> > definition is defined under /usr/include as expected. On the Ubuntu
> > it is not defined in either place. However, when I built the new
> > kernel I also built the new header files (which do include the macro
> > definitions). I can invoke the compiler with the include path as:
> >
> > gcc -I /usr/src/linux-headers-2.6.19.2-research/include msg_client.c
> > -o msg_client
> >
> > and I still get the same error message. When I use the -I -E -dD
> > switches together I notice the output file contains the kernel
> > #defines as expected.
> > I still cannot determine why the macro doesn't expand even though it
> > appears to have access to the definition. In the meantime, I have
> > been able to use the syscall() function instead of the macro with
> > success.
> >
> > Thanks for your time,
> >
> > Ryan
> >
> >>
> >> It's difficult to tell what the real problem is when looking
> >> at macros. You need to look at the code after macros have
> >> been expanded.
> >>
> >> Execute "gcc msg_client.c -E -dD -o msg_client.i" and take a
> >> look at what the _syscall2 macro generates.
> >>
> >> --
> >> Michael Eager eager@eagercon.com
> >> 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
> >>
> >
>
>
> --
> Michael Eager eager@eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
>
More information about the Gcc-help
mailing list