I am trying to compile a C ++ program on Windows using GCC and make file.
I get the following error
c:\mingw\include\math.h: In function 'float hypotf(float, float)': c:\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope { return (float)(_hypot (x, y)); }
I read that for any file that is included in GCC, the -lm linker flag is required. So I added this to my makefile, but that did not fix the problem ...
Here is my makefile
CC := g++ CFLAGS := -std=c++0x -g -O2 -static-libgcc -static-libstdc++ LFLAGS := -lm BIN_DIR := bin BUILD_DIR := build SRC_DIR := src MAIN := MyFirstVstMain TARGET := MyFirstVstMake SOURCES := $(wildcard src/*.cpp) OBJECTS := $(SOURCES:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o) $(BIN_DIR)/$(TARGET): CREATE_DIRS $(BUILD_DIR)/$(MAIN).o $(OBJECTS) $(CC) $(OBJECTS) $(CFLAGS) -o $@ $(LFLAGS) $(BUILD_DIR)/$(MAIN).o: $(SRC_DIR)/MyFirstVstMain.cpp $(CC) $(CFLAGS) -c -o $@ $< $(LFLAGS) $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/%.h $(CC) $(CFLAGS) -c -o $@ $< $(LFLAGS) CREATE_DIRS: if not exist $(BIN_DIR) mkdir $(BIN_DIR) if not exist $(BUILD_DIR) mkdir $(BUILD_DIR) CLEAN: if exist $(BUILD_DIR) rmdir /Q /S $(BUILD_DIR)
c ++ gcc windows g ++ mingw
Scottf
source share