Habib
Habib

Reputation: 41

error c2039 and error c2873 on Win CE 7 platform

The code can be compiled correctly for Win32 platform but for WinCe platform it results in many errors in Debug mode. The errors are related to the header files cstdio, cstring, and cwchar.

Microsoft Visual Studio 9.0\VC\ce\include\cstdio(82) :error C2039: '_gets_instead_use_StringCbGetsA_or_StringCchGetsA' : is not a member of '`global namespace''

error C2873: '_gets_instead_use_StringCbGetsA_or_StringCchGetsA' : symbol cannot be used in a using-declaration

error C2873: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : symbol cannot be used in a using-declaration

ce7\include\cwchar(66) : error C2873: 'swprintf_instead_use_StringCbPrintfW_or_StringCchPrintfW' : symbol cannot be used in a using-declaration

\include\armv4i\stdlib.h(146) : error C2065: '_malloca' : undeclared identifier

Upvotes: 1

Views: 432

Answers (2)

Habib
Habib

Reputation: 41

All I did, is to change the order of my include files. I put the "winsock2.h" header files after the other header files. And now i don't get those errors.

Before I had:  
#include < winsock2.h >                                                         
#include < vector >                                       
#include < map >       
#include < string >                     

After:  
#include < vector >  
#include < map >  
#include < string >  
#include < winsock2.h >  

Upvotes: 1

Valter Minute
Valter Minute

Reputation: 2210

The A suffix is usually connected to ASCII version of functions that have both 8bit and 16bit unicode version (the latter usually have W as suffix). Windows CE supports only unicode natively, so if you're trying to build code that uses ASCII you may have issues. There is a partial implementation of the ASCII function in the standard C/C++ library, covery the most commonly used functions and objects, but those that you are referencing may not be there. You can try to define UNICODE and _UNICODE to build the "W" version of that code, hoping that no parts of it made the assumption that 1 character=1 byte.

Upvotes: 1

Related Questions