Avarthar
Avarthar

Reputation: 25

mingw makefile compiler not outputting everything

I have had an error fixed with sdl, but another problem was noticed to me by Quentin. (Thanks again for the notice.)

Here is the problem: Nothing from the executable is logged in the console and I had an error where I had to convert a variable to string using .c_str(), but for some reason the compilation did not say anything about it.

Here is what my makefile looks like (I am not really good with makefiles yet as I don't really understand too much how all it works, but this is what I have for now):

#Is it in debug mode?
DEBUG=yes

SHELL='sh -x'

CC = G++

#OBJS specifies which files to compile as part of the project
OBJS = src/main.cpp

#OBJ_NAME specifies the name of the executable
OBJ_NAME = Game

INCLUDE_PATHS = -IC:/mingw_dev_lib/include/SDL2

LIBRARY_PATHS = -LC:/mingw_dev_lib/lib

COMPILER_FLAGS = -w -Wl,-subsystem,windows

LINKER_FLAGS = -lmingw32 -lSDL2main -lSDL2 -lSDL2_image

#This is the target that compiles the executable
all : $(OBJS)
ifeq ($(DEBUG),yes)
        g++ $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) -g $(LINKER_FLAGS) -o Debug\$(OBJ_NAME)
else
        g++ $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o Release\$(OBJ_NAME)
endif

Upvotes: 0

Views: 118

Answers (1)

grek40
grek40

Reputation: 13448

I guess the problem is kindof obvious once you look at the compiler flags...

Have a look at: Disable all gcc warnings

And then realize, that your COMPILER_FLAGS = -w -Wl,-subsystem,windows contain the -w flag. You should start by removing it (whatever reason it was there in the first place...) and including -Wall (thanks @keltar for pointing this out) instead, then see if the warnings start appearing like you want them.

Upvotes: 1

Related Questions