Compiling problems with wstring in c++
c++, visual-studio-2010, wstring
Solution
Try using the string header, and qualifying the namespace:
#include <string>
class GameInfo {
....
std::wstring m_wsVersion;
};
Problem
I need to refactor a .dll for a Zinc based Flash application. After copy&paste a class from the master to the branch, I'm getting some strange compiling errors: ``` GameInfo.h(15): error C2146: syntax error : missing ';' before identifier 'm_wsVersion' GameInfo.h(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int GameInfo.h(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ``` The addressed code: ``` // removed the comments #include "stdafx.h" #include <string.h> class GameInfo { public: UINT m_uiGameId; wstring m_wsVersion; // Line 15 UINT m_uiCheckSum; wstring m_wsFilePath; // Same error report as on line 15 public: static BOOL createFromFile(wstring path, GameInfo &target); // error "error C2061: syntax error : identifier 'wstring'" thrown }; ``` I use Visual Studio 2010 and in the IDE itself everything is okay, no syntactical errors or something like that. And as said I did not touch the code, headers seem fine. Has anyone a clue what about this error?