Windows Migration Linux Issue highlights

Source: Internet
Author: User
Tags sprintf

http://blog.csdn.net/m_star_jy_sy/article/details/8482202

1) ' _wcsicmp ' has not been declared in this scope

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

2) _stricmp not declared in this scope
#include <string.h>
change _stricmp to strcasecmp

3) The WCHAR version of Atoi does not exist,
#define _TTOI _wtoi
Change to use
#define _TCSTOL Wcstol

4) _atoi64
Change into
Atoll

5) ' Itoa ' has not been declared in this scope or ' _itoa ' has not been declared in this scope
Change into
sprintf (buf, "%d", n);

6) ' Ultoa ' has not been declared in this scope or ' _ultoa ' has not been declared in this scope
Change into
sprintf (buf, "%ul", n);

7) ' Ltoa ' has not been declared in this scope or ' _ltoa ' has not been declared in this scope
Change into
sprintf (buf, "%l", n);

8) ' _i64toa ' has not been declared in this scope
Change into

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

9) ' _ui64toa ' has not been declared in this scope
Change into
sprintf (buf, "%llu", N);

Htonl,htons,ntohl,ntohs not declared in this scope
include
#include <arpa/inet.h>

one) ' __int64 ' does not name a type
change __int64 to Long long
32 bits are ILP32 (Int,long,pointer is 32 bits), 64 bits are LP64 (Long,pointer 64), others are unchanged

' struct in_addr ' does not have a member named ' S_un '
in_addr IP;
IP. S_un. S_ADDR = "127.0.0.1";
the IP. S_un. S_addr changed to Ip.s_addr, as follows:
ip.s_addr = "127.0.0.1";

)
std::vector<internalobj<t>* >::iterator iter = Used_obj_.begin ();
error: expected '; ' before ' iter '

std::vector<int> Testv;
std::vector<int>::iterator iter1 = Testv.begin ();
The above two sentences are grammatically correct.

The C + + rule, which refers to the internal type of a nested template class (such as Std::vector<t>::iterator), must be shown to tell the compiler that this is a type rather than a variable.
For example
TypeName std::vector<internalobj<t>* >::iterator iter = Used_obj_.begin ();

This problem does not occur in the VC or Intel compiler.
The GCC compiler, however, is considered a variable in strict accordance with C + + regulations.
http://blog.csdn.net/tedious/article/details/6063910

)
Boost::timer
elapsed function Windows returns correctly, Linux returns 0

)
' memset ' has not been declared in this scope
' strlen ' has not been declared in this scope
' memcpy ' has not been declared in this scope
#include <string.h>
 
(+ )
' free ' has not been declared in this scope
' malloc ' has not been declared in this scope
#include <stdlib.h>

( ) ' _vsnprintf ' has not been declared in this scope
#include <stdarg.h>
change _vsnprintf to vsnprintf

' _snprintf ' has not been declared in this scope
#include <stdarg.h>
change _snprintf to snprintf

' _access ' has not been declared in this scope
#include <unistd.h>
change _access to access

)
typedef ace_hash_map_manager< cqq_userserial, suserappdacitem*,ace_thread_mutex> MAP_USER_APP_DAC;
Ace_thread_mutex is the same in Windows and Ace_synch_recursive_mutex, and is a recursive lock.
but under Linux
Ace_thread_mutex is a non-recursive lock, and the same thread will deadlock the second time it enters

)
char p;
under Windwos:
typeid (P). Name () equals "char"
under Linux is:
typeid (P). Name () equals "C"

unsigned long P
under Windwos:
typeid (P). Name () equals "unsigned Long"
under Linux is:
typeid (P). Name () equals "M"

unsigned short P
under Windwos:
typeid (P). Name () equals "unsigned short"
under Linux is:

typeID (P). Name () equals "T"

22)
SSP_EP.CPP:65: Error: Jump to label ' Redispatch_lab '
SSP_EP.CPP:37: Error: From here
SSP_EP.CPP:61: Error: Skipping initialization of ' cserverregevent* e '

GCC does not define a variable after a goto statement, it is required to define the {}.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.