2

I've a question about GCC and objects file..

In few words when I try to do this command:

gcc -Wall -o obj/config.o -c global.h config/config.c

It's simply returns this fatal error:

gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files

I've tried to search on Google, but I've not found anything about it. Maybe I used wrong keywords... Anyone can help?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Giuseppe
  • 531
  • 1
  • 5
  • 19

1 Answers1

2

.h header files don't get directly compiled, only .c source files. Get rid of global.h.

gcc -Wall -o obj/config.o -c config/config.c
John Kugelman
  • 349,597
  • 67
  • 533
  • 578
  • gcc allows direct compilation of `h` files with the default behaviour based on file extension being to generate a precompiled header. (Probably not what OP wants though) – M.M May 31 '19 at 01:21