c++ g++3.4.5 g++4.8.2 由编译器引起的编译异常
#include <memory>
#include <string>
#include <iostream> class Student {
public:
Student(std::string& name) {
_name = name;
}
~Student(){
} void printName(){
std::cout << _name << std::endl;
} private:
std::string _name;
}; int main() {
std::string name = "xiaowang";
std::unique_ptr<Student> p(new Student(name));
//Student p = Student(name);
//p.printName();
p->printName(); return ;
}
编译:默认g++3.4.5 报如下错误,unique_ptr是c++11的, g++3.4.5似乎也不支持这个。 main.cpp: In function 'int main()':
main.cpp::: error: 'unique_ptr' is not a member of 'std'
std::unique_ptr<Student> p(new Student(name));
^
main.cpp::: error: expected primary-expression before '>' token
std::unique_ptr<Student> p(new Student(name));
^
main.cpp::: error: 'p' was not declared in this scope
std::unique_ptr<Student> p(new Student(name)); 后经测试MM提示,改为用
/opt/compiler/gcc-4.8.2/bin/g++ -std=c++11 main.cpp (原来系统还藏了个高版本的,郁闷,干嘛不直接用高版本的啊) 编译无误。
^
c++ g++3.4.5 g++4.8.2 由编译器引起的编译异常的更多相关文章
- 【亲测】<g++/gcc>CentOS下g++: command not found问题的解决(c++环境安装)
CentOS下g++: command not found问题的解决 2017年02月27日 18:09:06 阅读数:5174 标签: centosgcc 更多 个人分类: 问题分析 版权声明: ...
- link options and how g++ is invoked gcc g++
yum install gcc yum install gcc-c++ yum reinstall gcc gcc-c++ Downloading packages:(1/2): gcc-c++-4. ...
- g++ -std=c++11 -g -o test emit_log_direct.cpp
g++ -std=c++11 -g -o test emit_log_direct.cpp
- linq 获取不重复数据,重复数据 var unique = arr.GroupBy(o => o).Where(g => g.Count() == 1) .Select(g => g.ElementAt(0));
static void Main(string[] args) { int[] arr = { 1, 3, 3, 3, 3, 4, 5, 4, 5, 8, 9, 3 }; //不重复 var uniq ...
- sed初理多行合并+sed之G、H、g、h使用+sed n/N使用说明
转载:[shell]sed处理多行合并 - seyjs - 博客园 (cnblogs.com) 文件格式 table=t1 name owner address table=t2 id text co ...
- Clang比 gcc/g++更人性化代码出错提示的C/C++编译器
编译器方面的几个命令 gcc/g++ 一. 常用编译命令选项 常用用法 gcc -Wall test.c -o test gcc编译过程 .c ->(-E)-> .i[中间文件] -> ...
- 【转】25.windbg-!gle、g(错误码、g系列)
!gle !gle 扩展显示当前线程的最后一个错误码.这个太好记了,getlasterror取首字母: <span style=:> !gle LastErrorValue: (Win32 ...
- CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)
---恢复内容开始--- CentOS 6.6 升级GCC G++ (当前最新GCC/G++版本为v6.1.0) 没有便捷方式, yum update.... yum install 或者 添加y ...
- [翻译svg教程]svg 中的g元素
svg 中的<g>元素用来组织svg元素.如果一组svg元素被g元素包裹了,你可以通过对g元素进行变换(transform),被g元素包裹的元素也将被变换,就好这些被svg包裹的元素是一个 ...
随机推荐
- cocos2dx-lua之断点调试支持
cocos2dx 3.2版对cocos code ide支持已经相当棒了,不过话说,编辑器用起来感觉没有sublime顺手 支持cocos code ide已经支持创建lua项目了,可是默认创建的项目 ...
- JQuery处理json与ajax返回JSON实例
一.JSON的一些基础知识. JSON中对象通过“{}”来标识,一个“{}”代表一个对象,如{“AreaId”:”123”},对象的值是键值对的形式(key:value). “[]”,标识数组,数组内 ...
- C# Winform里面用Console.WriteLine输出到哪了
C# Winform里面用Console.WriteLine输出也不会报错 显示在 VS IDE 的视图→输出窗口,且只在 Debug 环境下此语句执行. 如果是 Release 环境,在 Win32 ...
- php下载文件,添加响应头
//下载,添加响应头信息 header('Content-type:application/octet-stream'); header('Content-Disposition:attachment ...
- Linux命令行提示符设置
我们使用Linux系统时接触最多的是它的命令行窗口,很多时候我们都需要在命令行上输入命令,在输入的命令前都会有提示符,一般系统默认的提示符形式是:[username@host 工作目录]$. 其实,我 ...
- Linux系统环境变量及命令
Linux哪些我们常用,但是用的时候想不起来,这里做一个备忘录. Linux常用的变量: PATH 决定了shell将到哪些目录中寻找命令或程序 HOME 当前用户主目录 HISTSIZE 历史记录数 ...
- centos下安装图像化界面
前面我们安装的centos系统多为没有图像化界面的命令行界面,为了安装oracle等工具,我们先为我们的centos安装图像化界面 使用命令为 yum groupinstall "Deskt ...
- MySql安装时在Start Service处失败
安装MySql时在最后Start Service时失败: 首先先卸载掉MySql. 查看MySql服务有没有启动,若启动,则先停止MySql服务. 打开注册表,到HKEY_LOCAL_MACHIN ...
- Ubuntu下PHP开发配置(新增redis、sphinx、sqlserver相关配置)
由于本人比较懒,所以一般都是用xampp的直接拿来改的…………(当然xampp中一般php版本都是比较新的用的过程中请大家注意哈,可能会和老版本冲突) 此次除了使用xampp外,还扩展了sphinx, ...
- Vim一些实用的用法
打开多个文件: 1.vim还没有启动的时候:在终端里输入 vim file1 file2 ... filen便可以打开所有想要打开的文件2.vim已经启动输入:open file可以再打开一个文件,并 ...