我将windows下的项目修改为linux下时出现问题整理

1、undefined reference to `__gxx_personality_v0'

需要-l libstdc++

2、 makefile::*** 遗漏分隔符

makefile中命令前要有tab,否则会报错

3、tchar.h:没有那个文件或目录

在linux下没有tchar.h这个文件,可以自己写一个

#if defined(__BORLANDC__) && !defined(_TCHAR_DEFINED)typedef _TCHAR    TCHAR, *PTCHAR;typedef _TCHAR    TBYTE, *PTBYTE;#define _TCHAR_DEFINED#endif    

4、错误:‘abs’在此作用域中尚未声明

加入#include <stdlib.h>

5、 错误:‘vector’不是一个类型名

需要添加#include <vector>

using namespace std; //或者 using namespace std::vector;

6、对‘std::basic_ifstream<char>::open(std::string&)’的调用没有匹配的函数

:void std::basic_ifstream<_CharT, _Traits>::open(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]
       open(const char* __s, ios_base::openmode __mode = ios_base::in)

no known conversion for argument 1 from ‘std::string {aka std::basic_string<char>}’ to ‘const char*’

从上述报错来看需要把string类型的转换到const char*,string类型转换为const char* 只需在后面添加.c_str()即可。

7、:#warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
 #warning \
  ^

可以忽略此问题,根据提示在后面添加-Wno-deprecated

8、错误:‘runtime_error’不是‘std’的成员

<exception> defines only the base std::exceptionclass; if you want child classes like std::runtime_error, you must include the <stdexcept> header.

需要添加#include <stdexcept>

9、std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]
       basic_ofstream(const char* __s,
       ^
/usr/local/include/c++/4.8.1/fstream:640:7: 附注:  no known conversion for argument 1 from ‘std::string {aka std::basic_string<char>}’ to ‘const char*’
/usr/local/include/c++/4.8.1/fstream:625:7: 附注:std::basic_ofstream<_CharT, _Traits>::basic_ofstream() [with _CharT = char; _Traits = std::char_traits<char>]
       basic_ofstream(): __ostream_type(), _M_filebuf()

与6错误一样,把string类型的转换到const char*。

linux 编译C++错误整理相关推荐

  1. 编译linux内核错误的是,Linux编译内核错误

    作者:金良(golden1314521@gmail.com) csdn博客:http://blog.csdn.net/u012176591 给出编译Android内核过程中发生的两个同类性质的错误,都 ...

  2. linux libvpx编译安装,linux编译安装时常见错误解决办法

    **configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution** 复 ...

  3. linux编译安装的报错,linux编译安装时常见错误解决办法

    This article is post on https://coderwall.com/p/ggmpfa 原文链接:http://www.bkjia.com/PHPjc/1008013.html ...

  4. Linux编译x86架构内核出现_stack_chk_guard未定义错误

    背景 android模拟器运行于virtualbox中,而virtualbox运行于x86架构的pc端,所以android及其Linux内核都编译成x86架构.当virtualbox的vt未开启的情况 ...

  5. Linux编译遇到各种错误解决方法,例如 /lib/modules/3.10.0-(xxx).el7.x86_64/build: No such file or directory. Stop.

    Linux编译遇到各种错误解决方法,例如: /lib/modules/3.10.0-(xxx).el7.x86_64/build: No such file or directory. Stop. 背 ...

  6. Linux命令大全【整理汇集】

    Linux命令大全[整理&汇集] 标签(空格分隔): 文章目录 Linux命令大全[整理&汇集] 系统管理 文件系统管理 常用工具命令 Shell內建命令 系统安全 进程和作业管理 用 ...

  7. Linux系统日检常见问题,linux系统维护常见错误记录

    linux系统维护常见错误记录 发布时间:2008-09-17 21:32:34   作者:佚名   我要评论 一:卸载的时候出现的错误: umount /dev/nb1 device is busy ...

  8. linux 常用命令--------雪松整理

    linux 常用命令--------雪松整理 博客: http://hi.baidu.com/quanzhou722/blog 错误在所难免,还望指正! ======================= ...

  9. linux 编译c_含有CGO代码的项目如何实现跨平台编译

    目前小菜刀的项目中需要用到SQLite数据库,https://github.com/mattn/go-sqlite3支持database/sql接口,采用Go的标准接口有利于项目后续扩展,因此选择了该 ...

最新文章

  1. Git之提交项目到远程github
  2. SSH pager-taglib分页的实现
  3. 一元三次方程求解matlab_初中数学最全函数/方程【实际应用题】分类详解提升必学必练!...
  4. MEET大会报名开启 | 李开复张亚勤等产学研大咖邀你共同见证智能未来
  5. Python_List对象内置方法详解
  6. 缓存一致性(MESI)
  7. css样式表实验报告,css基本样式(二)
  8. Codeforces Beta Round #11 A. Increasing Sequence 贪心
  9. php inet pton,inet_pton 网络函数在PHP中的作用是什么
  10. amaze ui响应式辅助
  11. 1.1.0-简介-P12-分布式锁的解决方案(二)
  12. [Data]Link cut tree
  13. 读书笔记:《牛奶可乐经济学》
  14. 逻辑结构?存储结构?傻傻分不清……
  15. Gson的基本介绍和使用
  16. 半入耳蓝牙耳机推荐,音质最好的半入耳式蓝牙耳机品牌推荐
  17. centos7 安装英伟达驱动;cuda;docker离线安装;docker gpu离线安装;制作自己的cuda镜像;安装 容器中ssh协议
  18. OpenGL透视投影
  19. ALL in —— 雷军的极致
  20. QYT-X1S在高速公路可视化的网络解决方案

热门文章

  1. itemcf的hadoop实现优化(Python)
  2. curl请求模拟post发送json
  3. Java内存模型深度解析:锁--转
  4. 好技术领导和差技术领导区别在哪里--转
  5. haproxy 503 service unavailable no server is avaible to handle this request
  6. 作为大数据和云计算学习的一个序吧
  7. spring AOP策略模式使用
  8. JS中map()与forEach()的用法
  9. 中国国际智能产业博览会-2018-08-23至25 重庆国际博览中心举行
  10. 在电商界摸爬滚打10年,我学到这三点经验教训