Page 1 of 1

# include_next <stdint.h>, where is the next stdint.h

Posted: Tue Nov 04, 2014 8:54 pm
by MarkZar
Hi, I'm new to os development, I've created a cross-compiler according to the osdev tutorial(http://wiki.osdev.org/GCC_Cross-Compiler). I included the header file "stdint.h"(which was created with Cross-Compiler) in the boot.c file, but when compiling, there was an error about it:

Code: Select all

stdint.h:9:26: fatal error: stdint.h: No such file or directory
I looked into the"stdint.h" file, and found the following lines:

Code: Select all

#ifndef _GCC_WRAP_STDINT_H
#if __STDC_HOSTED__
# if defined __cplusplus && __cplusplus >= 201103L
#  undef __STDC_LIMIT_MACROS
#  define __STDC_LIMIT_MACROS
#  undef __STDC_CONSTANT_MACROS
#  define __STDC_CONSTANT_MACROS
# endif
# include_next <stdint.h>
#else
# include "stdint-gcc.h"
#endif
#define _GCC_WRAP_STDINT_H
#endif
From google, I learned that # include_next <stdint.h> is used to include the next available "stdinit.h" file. But there isn't another "stdint.h" file in my cross-compiler folder. My host system is 64bit linux, and I'm going to develop a 32bit system, I hope it doesn't want to use my 64bit system's stdint.h.

Any help appreciated.

Re: # include_next <stdint.h>, where is the next stdint.h

Posted: Tue Nov 04, 2014 9:12 pm
by sortie
I'll bet you forgot to pass -ffreestanding to your compiler. That's why __STDC_HOSTED__is non-zero.

The i686-elf target comes with a stdint.h header that is only meant to be used in kernel mode. In user-space, the standard library is supposed to supply its own version.

On other targets, generally the standard library is expected to supply a stdint.h. You can ask the compiler to supply one for your custom OS target, if desired.

Re: # include_next <stdint.h>, where is the next stdint.h

Posted: Wed Nov 05, 2014 12:44 am
by MarkZar
sortie wrote:I'll bet you forgot to pass -ffreestanding to your compiler. That's why __STDC_HOSTED__is non-zero.

The i686-elf target comes with a stdint.h header that is only meant to be used in kernel mode. In user-space, the standard library is supposed to supply its own version.

On other targets, generally the standard library is expected to supply a stdint.h. You can ask the compiler to supply one for your custom OS target, if desired.
Thank you, I got it.