Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling clang C++11 warnings

I cannot for the life of me get clang to stop warning me about C++11 extensions. Anywhere I use "auto" or any other C++11 extension it spits out a warning.

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

Here's 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's 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
like image 685
Lerp Avatar asked May 19 '13 20:05

Lerp


1 Answers

You need to pass all the compiler options to the compilation step as well:

$(OBJ_DIR)/%.o: %.cpp
    $(CXX) $(CXXFLAGS) $(INC_DIR) -c $< -g -o $@ 
#          ^^^^^^^^^^^
like image 133
Kerrek SB Avatar answered Dec 10 '22 14:12

Kerrek SB