我是靠谱客的博主 安详学姐,这篇文章主要介绍Ubuntu 14 g++ 使用c++11特性报错,现在分享给大家,希望可以做个参考。

  我使用的g++ 版本信息如下:

   g++ (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
   Copyright (C) 2013 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions.  There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   但是在编译使用了c++11 特性的代码时报错了

/Program/cppProgram$  g++ mixtype.cpp -o mixtype
mixtype.cpp: In function ‘int main()’:
mixtype.cpp:18:10: error: ‘ppb’ does not name a type
     auto ppb = arp;
          ^
mixtype.cpp:21:21: error: ‘ppb’ was not declared in this scope
     std::cout << (*(ppb+1))->year << std::endl;
                     ^
发现是auto导致不能编译的,auto实在c++ 中的特性,所以如下编译就不会报错:

g++ mixtype.cpp -o mixtype -std=c++11

编译通过;


最后

以上就是安详学姐最近收集整理的关于Ubuntu 14 g++ 使用c++11特性报错的全部内容,更多相关Ubuntu内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(50)

评论列表共有 0 条评论

立即
投稿
返回
顶部