2012-07-09 5 views
0

헤더 파일 (stdint.h)은 포함되어 있지 않습니다. 나는 많은 코드가 따르고 있음을 알고 있지만, 나는 정말로 모른다.헤더 파일이 제대로 포함되지 않았습니다.

내 파일 :

,536 :

gdt.c

/* We need 8 segments */ 
#include <stdint.h> 
#include "gdt.h" 
#define GDT_SIZE 8 
uint32_t intr; 

gdt_entry gdtable[GDT_SIZE]; 

은/gdt.h

#ifndef GDT_H 
#define GDT_H 
#include <stdint.h> 
struct gdt_entry{ 
    uint_16t limit; 
    uint_32t base :24; 
    uint_32t accessbyte :8; 
    uint_32t limit2 :4; 
    uint_32t flags2 :4; 
    uint_32t base2 :8; 
}__attribute__((packed)); 
#endif 

이/stdint.h

#ifndef STDINT_H 
#define STDINT_H 

typedef unsigned long long uint64_t; 
typedef unsigned int uint32_t; 
typedef unsigned short uint16_t; 
typedef unsigned char uint8_t; 

typedef signed long long int64_t; 
typedef signed int int32_t; 
typedef signed short int16_t; 
typedef signed char int8_t; 

#endif 

Makefile을 포함 포함

SRCS = $(shell find -name '*.[cS]') 
OBJS = $(addsuffix .o,$(basename $(SRCS))) 

CC = gcc 
LD = ld 

ASFLAGS = -m32 
CFLAGS = -m32 -Wall -g -fno-stack-protector -I include 
LDFLAGS = -melf_i386 -Tkernel.ld 

kernel: $(OBJS) 
    $(LD) $(LDFLAGS) -o [email protected] $^ 

%.o: %.c 
    $(CC) $(CFLAGS) -c -o [email protected] $^ 

%.o: %.S 
    $(CC) $(ASFLAGS) -c -o [email protected] $^ 

clean: 
    rm $(OBJS) 

.PHONY: clean 

kernel.ld

/* start should be executed first */ 
ENTRY(_start) 

/* 
* thats how the sections should be written in the .elf binary 
*/ 
SECTIONS 
{ 
    /* 
    * the first section has a 1MB Offset for the grub bootloader 
    */ 
    . = 0x100000; 

    /* 
     * the multiboot header comes first 
     */ 
    .text : { 
     *(multiboot) 
     *(.text) 
    } 
    .data ALIGN(4096) : { 
     *(.data) 
    } 
    .rodata ALIGN(4096) : { 
     *(.rodata) 
    } 
    .bss ALIGN(4096) : { 
     *(.bss) 
    } 
} 

GCC 출력 :

gcc -m32 -c -o start.o start.S 
gcc -m32 -Wall -g -fno-stack-protector -I include -c -o gdt.o gdt.c 
In file included from gdt.c:3:0: 
include/gdt.h:5:2: error: unknown type name ‘uint_16t’ 
include/gdt.h:6:2: error: unknown type name ‘uint_32t’ 
include/gdt.h:7:2: error: unknown type name ‘uint_32t’ 
include/gdt.h:8:2: error: unknown type name ‘uint_32t’ 
include/gdt.h:9:2: error: unknown type name ‘uint_32t’ 
include/gdt.h:10:2: error: unknown type name ‘uint_32t’ 
gdt.c:7:1: error: unknown type name ‘gdt_entry’ 
make: *** [gdt.o] Error 1 

답변

4

내가 대신 비표준 uint_32tuint32_t를 사용한다고 생각합니다. 최소한 내가 만난 세 번째 변형입니다. 이전에 u_int32_t도 보았습니다.

0

다른 문제가 있습니다. gdt_entry gdtable [GDT_SIZE]; struct gdt_entry gdtable이어야합니다. [GDT_SIZE]

관련 문제