Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22031

Not getting warning for implicit declaration of function [closed]

$
0
0

In one of my projects, for the functions that are defined elsewhere, I didn't include header file containing declaration. Still I'm not getting warning for implicit declaration

This is the entire content of the file and it compiles without warning:

void func(void) {
    putchar('i');
    printf("hello world");
    uart_puts(0, "hello", "world");
}

I'm expecting warning of this sort: implicit declaration of function ‘something’ [-Wimplicit-function-declaration]

I'm using arm based cross compiler: gcc-arm-none-eabi-4_9-2015q3

Compiler flags that I've tried:

-std=c99-pedantic-errors-Wimplicit-function-declaration

I tried appending -E to CFLAGS in Makefile. This time the file compiled but the entire project didn't build: Got this error:

...
CC: drivers/a.o
CC: drivers/gpio.o
CC: drivers/uart.o
CC: drivers/console.o
CC: init/main.o
CC: lib/stdio.o
CC: soc/sgk/sgk_init.o
LD: image.elf
drivers/a.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:111: recipe for target 'image.elf' failed
make: *** [image.elf] Error 1

When I try to compile that file directly. I see this error.

/usr/local/arm/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc -c drivers/a.c

drivers/a.c: In function 'func':
drivers/a.c:3:2: warning: incompatible implicit declaration of built-in function 'printf'
printf("hello world");

Any Idea what might be the issue?


Viewing all articles
Browse latest Browse all 22031

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>