By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,173 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,173 IT Pros & Developers. It's quick & easy.

wstring is causing a win32 console application to exit

P: 1

I have the below code snippet in an already existing Win32 console application.


wstring szTemp = _T("Template");


This piece of code perfectly compiles but when i run the application, it exits when hitting the above line.This line is in the main() function.
Aug 16 '10 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,197
There is a problem here:

Expand|Select|Wrap|Line Numbers
  1. wstring szTemp = _T("Template");
1) If your project is set for Unicode, then you don't use the TCHAR macros like _T.
2) If your project is set for ASCII, then you don't use wstring. You use string. There is no constructor for wstring that takes an ASCII string as a argument. That is, in ASCII this won't compile

Visual Studio.NET 2008 will not compile this code. So, what compiler are you using?
Aug 16 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.