Lowlevel

Lowlevel => Lowlevel-Coding => Thema gestartet von: Martin Erhardt am 02. February 2013, 11:30

Titel: conflicting types for built-in function ‘printf’ trotz -nostdinc
Beitrag von: Martin Erhardt am 02. February 2013, 11:30
bei der Implementierung meines Syscalls habe ich folgendes Problem:
gcc -m32 -Werror -Wall -g -fno-stack-protector -nostdinc -I lib -c -o tst.o tst.c
tst.c:5:6: error: conflicting types for built-in function ‘printf’ [-Werror]
Titel: Re: conflicting types for built-in function ‘printf’ trotz -nostdinc
Beitrag von: KtmnjjpfjsFvzG am 02. February 2013, 12:36
Zeig mal den Code an der entsprechenden Stelle...
Titel: Re: conflicting types for built-in function ‘printf’ trotz -nostdinc
Beitrag von: Martin Erhardt am 02. February 2013, 13:41
#include <stdint.h>

#define SYS_WRITE 0

void printf(const char* fmt, ...);
void printfstrcol_scr(uint8_t font, const char* fmt);

void _start(void)
{
    printf("sghs");
 
    while(1);
}
void printf(const char* fmt, ...){
    uprintfstrcol_scr(0xF0,fmt);
}
void printfstrcol_scr(uint8_t font, const char* fmt){
    ...
}
Titel: Re: conflicting types for built-in function ‘printf’ trotz -nostdinc
Beitrag von: MNemo am 02. February 2013, 13:46
-nostdinc¹ (http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Preprocessor-Options.html#index-nostdinc-943) sagt nur wo nach header-dateien gesucht werden soll, und hat nix mit built-in funktionen zu tun.
Das flag das du brauchst heißt -ffreestanding² (http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/C-Dialect-Options.html#index-ffreestanding-111)