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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
MarkZar
Posts: 13
Joined: Thu Feb 07, 2013 11:53 pm

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

Post 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.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

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

Post 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.
MarkZar
Posts: 13
Joined: Thu Feb 07, 2013 11:53 pm

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

Post 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.
Post Reply