Compilation issues while including header stddef.h

Discussion in 'C Programming' started by Arun, Jan 3, 2012.

  1. Arun

    Arun Guest

    Hello,
    I am trying to build a 64bit shared library out of C routines and i
    got in to some issues while including the header file stddef.h. I am
    using nmake comands (for VS 2008 Ver 9.0) to compile the sources. It
    would be much helpful if some body can throw some light on the
    following errors i am encountering.

    C:\Apps\SC03-Ver14\jm72_orig\src\jm72>nmake /f Makefile.nmake all
    arch=win64

    Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
    Copyright (C) Microsoft Corporation. All rights reserved.

    Compiling file hal_adf_c.c
    "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
    \amd64\cl" /c
    /DUPPERCASE /DnoFLEXM /D__HDF /DEZXML_NOMMAP /
    DNOUNDERSCORE /O
    2 /c /I..\..\include /I /I /I..\..\include\jm72 /I"C:\Apps\SC03-
    Ver14\prop\CGNS
    \include\ADF" /I"C:\Apps\SC03-Ver14\prop\HDF5\1.8.7_x64\include
    \hdf5_ser" hal_
    adf_c.c /Fohal_adf_c.owin64
    Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    hal_adf_c.c
    ...\..\include\jm72\stddef.h(5) : error C2054: expected '(' to follow
    '__SIZE_TYP
    E__'
    ...\..\include\jm72\stddef.h(6) : error C2085: '__WCHAR_TYPE__' : not
    in formal p
    arameter list
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
    Studio 9.0\
    VC\bin\amd64\cl.EXE"' : return code '0x2'
    Stop.

    The file stddef.h reads as follows.

    #ifndef _STDDEF_H
    #define _STDDEF_H

    #define NULL ((void *)0)
    typedef __SIZE_TYPE__ size_t;
    typedef __WCHAR_TYPE__ wchar_t;
    typedef __PTRDIFF_TYPE__ ptrdiff_t;
    #define offsetof(type, field) ((size_t) &((type *)0)->field)

    /* need to do that because of glibc 2.1 bug (should have a way to test
    presence of 'long long' without __GNUC__, or TCC should define
    __GNUC__ ? */
    #if !defined(__int8_t_defined) && !defined(__dietlibc__)
    #define __int8_t_defined
    typedef char int8_t;
    typedef short int int16_t;
    typedef int int32_t;
    typedef long long int int64_t;
    #endif

    void *alloca(size_t);

    #endif


    Here comes the details regarding the C compiler.

    C:\Apps\SC03-Ver14\jm72_orig\src\jm72>cl -version
    Microsoft (R) C/C++ Optimizing Compiler Version 15.00.21022.08 for x64
    Copyright (C) Microsoft Corporation. All rights reserved.

    cl : Command line warning D9002 : ignoring unknown option '-version'
    cl : Command line error D8003 : missing source filename

    Any inputs on this would be highly appreciated.

    Thanks in advance,
    Arun
    Arun, Jan 3, 2012
    #1
    1. Advertising

  2. Arun

    Dr Nick Guest

    Arun <> writes:

    [much snipping]

    > Compiling file hal_adf_c.c
    > "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
    > \amd64\cl" /c


    > hal_adf_c.c
    > ..\..\include\jm72\stddef.h(5) : error C2054: expected '(' to follow
    > '__SIZE_TYP
    > E__'
    > ..\..\include\jm72\stddef.h(6) : error C2085: '__WCHAR_TYPE__' : not
    > in formal p
    > arameter list
    >
    > The file stddef.h reads as follows.
    >
    > #ifndef _STDDEF_H
    > #define _STDDEF_H
    >
    > #define NULL ((void *)0)
    > typedef __SIZE_TYPE__ size_t;
    > typedef __WCHAR_TYPE__ wchar_t;
    > typedef __PTRDIFF_TYPE__ ptrdiff_t;


    The problem is almost certainly in hal_adf_c.c before you #include
    stddef.h. Or in another .h file #included immediately before stddef.h

    I usually get this sort of thing by forgetting the semicolon on the end
    of a structure definition.
    --
    Online waterways route planner | http://canalplan.eu
    Plan trips, see photos, check facilities | http://canalplan.org.uk
    Dr Nick, Jan 3, 2012
    #2
    1. Advertising

  3. Arun

    Eric Sosman Guest

    On 1/3/2012 2:44 AM, Dr Nick wrote:
    > Arun<> writes:
    >> [...]
    >> The file stddef.h reads as follows.
    >>
    >> #ifndef _STDDEF_H
    >> #define _STDDEF_H
    >>
    >> #define NULL ((void *)0)
    >> typedef __SIZE_TYPE__ size_t;
    >> typedef __WCHAR_TYPE__ wchar_t;
    >> typedef __PTRDIFF_TYPE__ ptrdiff_t;

    >
    > The problem is almost certainly in hal_adf_c.c before you #include
    > stddef.h. Or in another .h file #included immediately before stddef.h


    Another possibility: The <stddef.h> in question belongs with
    a different compiler, one that has __SIZE_TYPE__ etc. as built-ins.

    Two points about the exhibited <stddef.h> make this hypothesis
    believable (although they don't prove it, of course): First, there's
    no Microsoft copyright at the start of the file, suggesting it's not
    part of a Microsoft product. Second, the original has a comment
    about working within the Gnu frameworks (see the OP; it's snipped
    from the response), and that's not something I'd expect Microsoft to
    be much concerned about.

    --
    Eric Sosman
    d
    Eric Sosman, Jan 3, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kpoan
    Replies:
    0
    Views:
    377
    kpoan
    Aug 15, 2006
  2. Roka

    Should I include this <stddef.h> ?

    Roka, Feb 17, 2006, in forum: C Programming
    Replies:
    2
    Views:
    464
    Ian Collins
    Feb 17, 2006
  3. , India
    Replies:
    2
    Views:
    347
    Michael DOUBEZ
    Jan 16, 2009
  4. mlt
    Replies:
    2
    Views:
    805
    Jean-Marc Bourguet
    Jan 31, 2009
  5. Bill Cunningham

    stddef.h

    Bill Cunningham, Aug 17, 2009, in forum: C Programming
    Replies:
    13
    Views:
    2,938
    David Thompson
    Aug 31, 2009
Loading...

Share This Page