【发布时间】:2017-03-19 04:23:33
【问题描述】:
我正在使用源文件在 kali linux 中安装代码块。但是当我发出 make 命令时,我得到了以下错误
usr/include/c++/6/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
我用谷歌搜索了这个错误,并得到了在我的 Makefile 中使用它并重新编译的以下解决方案
CXX=clang++
CXXFLAGS=-g -std=c++11 -Wall -pedantic
BIN=prog
SRC=$(wildcard *.cpp)
OBJ=$(SRC:%.cpp=%.o)
all: $(OBJ)
$(CXX) -o $(BIN) $^
%.o: %.c
$(CXX) $@ -c $<
clean:
rm -f *.o
rm $(BIN)
但这也行不通。我是 linux 新手,不知道如何在 gcc 中启用 c++11 模式。
【问题讨论】:
-
我没有看到你在任何地方使用
CXXFLAGS。这就是这里的关键。 -
显然您不了解自己的 makefile 并尝试使用 GNU Make,然后才不厌其烦地了解它的基本工作原理。这里是a fairly good beginner's tutorial about GCC and GNU Make。对于权威文档,这里是GNU Make manual
标签: c++ linux c++11 installation