when I start to test a demo Win32 application, I ran into several easy problems. take note now for future reference.
step 1: create a new project.
step 2: select Win32 application. do not use Wizards.
step 3: give your project a name, the press OK. then select "emptry Project".
step 4: add your files to project.
step 5: once the project files are created, you need manually select the static MFC class library.
you can set this through project property-> Configuation Properties-> General ->Use of MFC-> user MFC static library.
- FAQ: Cannot convert from 'const char [..]' to 'LPCTSTR'
- Cannot convert argument 1 from 'const char ' to 'LPCTSTR'
- td::wstring VS std::string
This error message means that you are trying to pass a multi-byte string (const char ) to a function which expects a unicode string (LPCTSTR). The LPCTSTR type extends to const TCHAR*, where TCHAR is char when you compile for multi-byte and wchar_t for unicode. Since the compiler doesn't accept the char array, we can safely assume that the actual type of TCHAR, in this compilation, is wchar_t.
You will have to do one of two things:
1. Change your project configuration to use multibyte strings. Press ALT+F7 to open the properties, and navigate to Configuration Properties > General. Switch Character Set to "Use Multi-Byte Character Set".
2. Indicate that the string literal, in this case "Hello world!" is of a specific encoding. This can be done through either prefixing it with L, such as L"Hello world!", or surrounding it with the generic _T("Hello world!") macro. The latter will expand to the L prefix if you are compiling for unicode (see #1), and nothing (indicating multi-byte) otherwise.