1

For some reason, when calling certain functions for which I have not included the appropriate header file, I do not always get a compile-time "function is not declared / defined" error. It's a real source of headaches. Most recently, calling glfwGetTime() returned zero when the header was not included, but correct values when it was, wasting a lot of debugging time.

I've noticed that when compiling same code under Linux / native GCC, these tend to be caught.

Here are my compiler options:

CFLAGS = -I$(LIBDIR) $(INCLUDES) -std=c11 -m$(BITS) -fms-extensions -fopenmp -Wall -Wextra -Wimplicit-function-declaration -Werror -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wlogical-op -Wcast-align -Wconversion -Wpedantic -Wfloat-equal -w -O0 -MMD

Any ideas why these aren't being caught at compile? P.S. This is NOT related to printf().

Community
  • 1
  • 1
Engineer
  • 8,529
  • 7
  • 65
  • 105
  • "I do not always [...]" does this mean that sometimes you *do* have warnings with mingw? Likewise, "these tend to be caught" might give the impression that sometimes they are not; is it the case? The compiler options you gave are useful, but you would probably have more feedback by providing also minimal working examples (see http://sscce.org/) where warnings definitely are not reported with one compiler but reported with the other... – coredump Nov 19 '15 at 23:47
  • [This answer](http://stackoverflow.com/questions/12188230/mingw-compiler-doesnt-need-function-declarations) suggests using `-Wimplicit`, which does not appear in your list, but this is pure speculation – coredump Nov 19 '15 at 23:47
  • @coredump I'm sorry - let me rather say I have never had the issue under linux that I can recall, so the "tend" should not be there. Under Windows I have the impression however that gcc does not always fail to notify me of such issues, that is, it sometimes does so, other times not and I'm not sure what the distinction is. I'll try -Wimplicit next time this crops up, rather than blindly putting it in now and hoping it fixes the problem. – Engineer Nov 20 '15 at 01:53

0 Answers0