windows程序移植到linux总结

本文总结了在Linux环境下编译过程中常见的八个问题及其解决方法,包括与max和min函数冲突、类内部枚举使用、模板参数列表中位运算符、std命名空间内未声明的shared_ptr、atoi函数未包含头文件、sprintf_s替代方案、memcpy依赖头文件缺失以及mosek::fusion命名空间下的Utils成员问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先要写makefile,很简单,有专门博客,大家去搜一下..下面把编译时遇到的问题总结下.大部分解决方法是从网上找的,这里对看过文章的作者表示感谢.

1, max,min函数,自己代码实现了这两个函数,会和linux自带的有冲突.

      解决方法: 删除自己的函数

2, error: ‘STATUS’ is not a class or namespace

       解决方法:类内部枚举不要加namespace符号,直接写枚举变量

3, ‘>>’ should be ‘> >’ within a nested template argument list

      解决方法:>>之间加空格.linux防止歧义.

4, ‘std::shared_ptr’ has not been declared

    解决方法:std::tr1::shared_ptr,添加头文件#include<tr1/memory>

5, ‘atoi’ is not a member of ‘std’

    解决方法:#include <cstdlib>

6, ‘sprintf_s’ was not declared in this scope

    解决方法:换为snprintf

7, there are no arguments to memcpy that depend on a template parameter, so a declaration of memcpy must be available

   解决方法: 主要是没包含头文件,添加#include <string.h>, 或是"man memcpy",就可以看到依赖的头文件.

8, 'Utils’ is not a member of ‘mosek::fusion’

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值