传递GCC标志-std = c ++ 11 CXXFLAGS或CXX或CFLAGS [英] passing GCC flag -std=c++11 CXXFLAGS or CXX or CFLAGS

查看:2430
本文介绍了传递GCC标志-std = c ++ 11 CXXFLAGS或CXX或CFLAGS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的需要一些帮助,在这里一个基本的问题。我将永远放弃学习GCC,因为它似乎基本只是对我没有意义。我已经读了几百篇文章,不能弄清楚如何获得一个基本的 -std = c ++ 11 调用工作通过 configure



在这个例子中,我编译了gcc 5.3和大多数程序编译ok,例如编译httpd从源工程没有问题。但我不断收到我认为是 -std = c ++ 11 的错误。我读过的所有帖子都表示通过 -std = c ++ 11 ,我试过了

  CXXFLAGS = -std = c ++ 11 
CXX = -std = c ++ 11
CFLAGS = -std = c ++ 11



但错误仍然存​​在。



我现在正在尝试编译aspell,以下错误

 在/ home / mybin / include / algorithm:62:0,
/home/atmp/aspell-0.60.6.1/common/string.hpp:13,
来自/home/atmp/aspell-0.60.6.1/common/indiv_filter.hpp:12,
来自/ home /atmp/aspell-0.60.6.1/modules/filter/email.cpp:9:
/home/mybin/include/bits/stl_algo.h:在函数'void std :: random_shuffle(_RAIter,_RAIter)' :
/home/mybin/include/bits/stl_algo.h:4448:8:错误:'rand'不是'std'的成员
+ std :: rand()%((__i - __first)+ 1);

算法似乎已从gcc5.3编译。
请指出正确的方向来排查这些类型的错误。



编译GCC时,我错过了编译选项吗?

$ b $在< cstdlib>中定义

解决方案

std :: rand code>,它与C ++ 11无关,这个头很久以前就有了。检查源中是否 #include d。


I really need some help with a basic question here please. I am about to give up forever on learning GCC as it seems like the basics just do not make sense to me. I have read hundreds of posts and can not figure out how to get a basic -std=c++11 call to work passed via configure

In this example I have compiled gcc 5.3 and most programs compile ok, for example compiling httpd from source works no problems. But I keep getting errors relating to what I think is -std=c++11. All the posts I read say to pass -std=c++11 and I have tried

CXXFLAGS=-std=c++11 
CXX=-std=c++11 
CFLAGS=-std=c++11

but the errors persist.

I am now attempting to compile aspell, and get the following error,

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 seems to have installed correctly from the gcc5.3 compile. Please point me in the right direction to troubleshoot these types of errors.

Did I miss a compile option when compiling GCC?

解决方案

std::rand is defined in <cstdlib>, and it has nothing to do with C++11, this header was there a long time ago. Check that it is #included in the source.

这篇关于传递GCC标志-std = c ++ 11 CXXFLAGS或CXX或CFLAGS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆