歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Windows遷移Linux問題集錦

Windows遷移Linux問題集錦

日期:2017/2/28 14:54:13   编辑:Linux教程

1)‘_wcsicmp’在此作用域中尚未聲明

#ifdef WIN32
#define _tcsicmp _wcsicmp
#else
#define _tcsicmp wcscasecmp
#endif

2)_stricmp 在此作用域中尚未聲明
#include <string.h>
將_stricmp改成strcasecmp

3)atoi的wchar版本不存在,
#define _ttoi _wtoi
改成使用
#define _tcstol wcstol

4)_atoi64
改成
atoll

5)‘itoa’在此作用域中尚未聲明 或者 ‘_itoa’在此作用域中尚未聲明
改成
sprintf(buf,"%d",n);

6)‘ultoa’在此作用域中尚未聲明 或者 ‘_ultoa’在此作用域中尚未聲明
改成
sprintf(buf,"%ul",n);

7)‘ltoa’在此作用域中尚未聲明 或者 ‘_ltoa’在此作用域中尚未聲明
改成
sprintf(buf,"%l",n);

8)‘_i64toa’在此作用域中尚未聲明
改成

sprintf(buf,"%lld",n);


9)‘_ui64toa’在此作用域中尚未聲明
改成
sprintf(buf,"%llu",n);


10)htonl,htons,ntohl,ntohs 在此作用域中尚未聲明
包含
#include <arpa/inet.h>

11)‘__int64’沒有命名一個類型
將__int64 改為 long long
32位為ILP32(int,long,pointer為32位),64位采用LP64(long,pointer為64),其他不變

12)‘struct in_addr’沒有名為‘S_un’的成員
in_addr ip;
ip.S_un.S_addr = "127.0.0.1";
將ip.S_un.S_addr改為ip.s_addr,如下:
ip.s_addr = "127.0.0.1";

Copyright © Linux教程網 All Rights Reserved