Disabling clang c ++ 11 warnings

I can’t be silenced by my life, warning me about C ++ 11 extensions. Anywhere where I use "auto" or any other C ++ 11 extension, it gives a warning.

I have the -Wno-c++11-extension flag, but it still prints them.

Here is my makefile:

 CXX = clang++ CXXFLAGS = -std=c++11 -Wall -Wno-c++11-extensions LIBS = -lglfw -lGL -lGLU -lGLEW OBJ_DIR = bin LIB_DIR = -L/usr/lib INC_DIR = -I/usr/include SOURCE = $(wildcard *.cpp) OBJECTS = ${SOURCE:%.cpp=$(OBJ_DIR)/%.o} EXECUTABLE = vox ARGS = -w1024 -h800 .PHONY: init clean all: init $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CXX) $(CXXFLAGS) $(LIB_DIR) -o $@ $(OBJECTS) $(LIBS) $(OBJ_DIR)/%.o: %.cpp $(CXX) $(INC_DIR) -c $< -g -o $@ run: init $(EXECUTABLE) @echo $(ls . | grep *.cpp) @./$(EXECUTABLE) $(ARGS) init: @mkdir -p "$(OBJ_DIR)" clean: @rm -rf $(OBJ_DIR) $(EXECUTABLE) 

Here is my clang++ --version output

 Ubuntu clang version 3.2-1~exp5ubuntu1~precise1 (tags/RELEASE_32/final) (based on LLVM 3.2) Target: x86_64-pc-linux-gnu Thread model: posix 
+4
source share
1 answer

You also need to pass all the compiler options to the compilation stage:

 $(OBJ_DIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) $(INC_DIR) -c $< -g -o $@ # ^^^^^^^^^^^ 
+6
source

Source: https://habr.com/ru/post/1481660/


All Articles