【问题标题】:How to enable c++11 in make command in kali linux如何在kali linux的make命令中启用c++11
【发布时间】: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 模式。

【问题讨论】:

标签: c++ linux c++11 installation


【解决方案1】:

CXXFLAGS 未被使用。您可以将所有规则修改为

all: $(OBJ)
    $(CXX) $(CXXFLAGS) -o $(BIN) $^

【讨论】:

  • 嗨,我使用了这个修复,但在终端中仍然出现同样的错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-04
  • 1970-01-01
  • 2022-01-08
  • 2015-09-06
  • 2011-02-13
  • 1970-01-01
相关资源
最近更新 更多