stddef isn't being included, uintX_t types not found(Solved)
- Mikumiku747
- Member
- Posts: 64
- Joined: Thu Apr 16, 2015 7:37 am
Re: stddef isn't being included, uintX_t types not found(Sol
Sorry to annoy you once again, but it seems as though as soon as I try to include any other source files I wrote into kernel.c, those source files can't find stdint, even though they're just being included into the main kernel file. I made sure to use -ffreestanding, but it still won't include them. As a cheap bandaid fix, I included a file with the typedefs, but I'd rather use the one included with the compiler, any ideas on how to fix it?
Re: stddef isn't being included, uintX_t types not found(Sol
Uhmm... Give me a while. I'll try to find something inside the guts of my i686-elf-gcc instalation. I'll post it in an edit.
The Holy Edit:
Don't know what happens to you. I do have a stdint.h in /usr/bluesky/cross/lib/gcc/i686-elf/4.9.2/include/stdint.h. BTW, I don't use it . What I do is that my kernel has a <def.h> file generated by the build process for each compiler/architecture pair. <def.h> has just the most common definitions, as it's include in almost every source file of my kernel. For example, this is the one for GCC-4.8.2/x86 (this is handwritten):
You could use a similar design. BTW, the tabs got misaligned in the code, as I use 4-tabs, but the forum appears to use 8-tabs.
The Holy Edit:
Don't know what happens to you. I do have a stdint.h in /usr/bluesky/cross/lib/gcc/i686-elf/4.9.2/include/stdint.h. BTW, I don't use it . What I do is that my kernel has a <def.h> file generated by the build process for each compiler/architecture pair. <def.h> has just the most common definitions, as it's include in almost every source file of my kernel. For example, this is the one for GCC-4.8.2/x86 (this is handwritten):
Code: Select all
#pragma once
// Everything that is written here goes exported *everywhere* in the kernel and modules
#ifndef __ARCH__
#error Target architecture not defined!
#else
#define __kconfigARCH__ __ARCH__
#endif
#ifndef __VER__
#error Kernel version not defined!
#else
#define __kconfigVER__ __VER__
#endif
typedef long unsigned int Size;
typedef long signed int SSize;
typedef unsigned char UInt8;
typedef signed char SInt8;
typedef unsigned short UInt16;
typedef unsigned int UInt32;
typedef unsigned long long UInt64;
typedef UInt8 Byte;
typedef bool Bool;
typedef const char* String;
typedef char* MutableString;
typedef const UInt16* UString;
typedef Size PID; // Process ID
typedef Size TID; // Thread ID
typedef Size UID; // User ID
typedef Size GID; // Group ID
typedef void* Address;
typedef const void* ConstAddress;
/* All sort of utilities for clean code and
* abstractions over the kernel's black magic
* that somewhat affect C++'s constructs. */
#define AC(addr, type) ((type*)(addr))
#define AS(addr, off) (Address)(((Size)(addr)) + ((Size)(off)))
#define KConfig(sym) __kconfig ## sym ## __
#define _Stringify(x) #x
#define Stringify(x) _Stringify(x)
#define ArchFind(file) <../arch/__ARCH__/inc/file>
#define Assembly asm volatile
#define Attribute(attr) __attribute__((__ ## attr ## __))
#define AttributeArgs(attr, ...) __attribute__((__ ## attr ## __(__VA_ARGS__)))
#define Inline inline Attribute(always_inline)
#define NoInline Attribute(noinline)
#define Unused Attribute(unused)
#define Packed Attribute(packed)
#define NoReturn Attribute(noreturn)
#define Hot Attribute(hot)
#define Align(bytes) AttributeArgs(aligned, bytes)
#define CLinkage extern "C"
#define LittleEndian 0
#define BigEndian 1
#define Endianness LittleEndian
#define ASMExport(ret, name) CLinkage ret __clink_ ## name ## __
// Placement new/delete
Inline Address operator new (Size, Address p) throw() { return p; }
Inline Address operator new[] (Size, Address p) throw() { return p; }
Inline void operator delete (Address, Address) throw() {}
Inline void operator delete[] (Address, Address) throw() {}
Happy New Code!
Hello World in Brainfuck :[/size]
Hello World in Brainfuck :
Code: Select all
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.