gpt4 book ai didi

c++ - 传递 GCcflags -std=c++11 CXXFLAGS 或 CXX 或 CFLAGS

转载 作者:行者123 更新时间:2023-11-28 05:43:30 24 4
gpt4 key购买 nike

我真的需要一些基本问题的帮助。我即将永远放弃学习 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 时是否遗漏了一个编译选项?

最佳答案

std::rand<cstdlib> 中定义,而且它与 C++11 无关,这个头文件很久以前就有了。检查它是#include d 在源中。

关于c++ - 传递 GCcflags -std=c++11 CXXFLAGS 或 CXX 或 CFLAGS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36669538/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com