【发布时间】:2016-08-08 17:57:32
【问题描述】:
我真的需要一些帮助来解决一个基本问题。我将永远放弃学习 GCC,因为基础知识对我来说似乎没有意义。我已经阅读了数百篇帖子,但无法弄清楚如何通过configure 获得基本的-std=c++11 工作电话
在这个例子中,我编译了 gcc 5.3 并且大多数程序都可以编译,例如从源代码编译 httpd 没有问题。但我不断收到与我认为是-std=c++11 相关的错误。我读过的所有帖子都说通过-std=c++11,我已经尝试过
CXXFLAGS=-std=c++11
CXX=-std=c++11
CFLAGS=-std=c++11
但错误仍然存在。
我现在正在尝试编译 aspell,并得到以下错误,
In file included from /home/mybin/include/algorithm:62:0,
from /home/atmp/aspell-0.60.6.1/common/string.hpp:13,
from /home/atmp/aspell-0.60.6.1/common/indiv_filter.hpp:12,
from /home/atmp/aspell-0.60.6.1/modules/filter/email.cpp:9:
/home/mybin/include/bits/stl_algo.h: In function ‘void std::random_shuffle(_RAIter, _RAIter)’:
/home/mybin/include/bits/stl_algo.h:4448:8: error: ‘rand’ is not a member of ‘std’
+ std::rand() % ((__i - __first) + 1);
algorithm 似乎已从 gcc5.3 编译中正确安装。
请指出正确的方向来解决这些类型的错误。
我在编译 GCC 时是否错过了编译选项?
【问题讨论】:
-
您想在
Makefile中指定CXXFLAGS;然后该值将作为命令行选项传递给g++。但是由于Makefile是由configure脚本自动生成的,所以您的问题实际上是关于autotools,而不是gcc。 -
我不知道 GCC 编译的拼写 :)