   OutputDebugString() won't work in another program
  I can get OutputDebugString() to work fine in a program but not in another.For example, this works in one but not in the other:std::string aString("Hello World");OutputDebugString(aString.c_str());In the non-working one it sayserror C2664: 'OutputDebugStringW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'What would make it work in one but not another? I remember having this problem before and I never found out why.   
  OutputDebugString() is a macro that depends on whether or not Unicode is set for the project. If it is, then it expects a LPCWSTR argument. If not, it expects an LPCSTR argument. If you want to use it with std::string, go to your project properties under general and change the character set from Unicode to multi-byte.   ;  Your (non-working) project is set to use wide strings rather than ASCII strings. The char* returned from std::string::c_str() is not compatible with wide strings.There are a couple of options: turn off wide strings for your entire project; use std::wstring; or manually call OutputDebugStringA(). Note that if you keep wide strings enabled, "foo" creates a char* string while L"foo" creates a wchar_t* string (which is compatible with LPCWSTR).   ;  Excellent... works now. Must have been one of the settings for setting up DirectX that involved changing the character set in the working program...Thanks.   ;Quote:Original post by ApochPiQThere are a couple of options: turn off wide strings for your entire project; use std::wstring; or manually call OutputDebugStringA().With a small template wrapper, it's also possible to let the compiler figure it out based on the string type. Granted, employing it for a single function is overkill, but I've found it generally useful in a few homegrown projects.   