Compilation issues while including header stddef.h

A

Arun

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
 
D

Dr Nick

[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.
 
E

Eric Sosman

Arun said:
[...]
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top