CString::Format - Debug vs Release
-
I have a program that uses at least 50 calls to the CString::Format function. The problem comes when I change from Debug to Release mode and try to compile. In Release mode, the function expects a 'const wchar_t *' and in Debug a 'const char *'. I know that you can use the 'L' macro to make a literal string a 'const wchar_t *', but then it doesn't work when I switch back to Debug. Is there a way to get around this or do I just have to save my release compilation until the very end and add the 'L' macro to all of these functions? Also, does anybody know the reason Microsoft did this? Thanks, Dustin
-
I have a program that uses at least 50 calls to the CString::Format function. The problem comes when I change from Debug to Release mode and try to compile. In Release mode, the function expects a 'const wchar_t *' and in Debug a 'const char *'. I know that you can use the 'L' macro to make a literal string a 'const wchar_t *', but then it doesn't work when I switch back to Debug. Is there a way to get around this or do I just have to save my release compilation until the very end and add the 'L' macro to all of these functions? Also, does anybody know the reason Microsoft did this? Thanks, Dustin
-
I have a program that uses at least 50 calls to the CString::Format function. The problem comes when I change from Debug to Release mode and try to compile. In Release mode, the function expects a 'const wchar_t *' and in Debug a 'const char *'. I know that you can use the 'L' macro to make a literal string a 'const wchar_t *', but then it doesn't work when I switch back to Debug. Is there a way to get around this or do I just have to save my release compilation until the very end and add the 'L' macro to all of these functions? Also, does anybody know the reason Microsoft did this? Thanks, Dustin
-
Could it be that the release build is unicode, and debug build isn't?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
Good call. That fixed it. I didn't even think about checking that. You're the man.
-
Debug vs Release or Debug vs RELEASE UNICODE?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
I love this board. 2 helpful answers in under 10 minutes.
-
Good call. That fixed it. I didn't even think about checking that. You're the man.
-
I have a program that uses at least 50 calls to the CString::Format function. The problem comes when I change from Debug to Release mode and try to compile. In Release mode, the function expects a 'const wchar_t *' and in Debug a 'const char *'. I know that you can use the 'L' macro to make a literal string a 'const wchar_t *', but then it doesn't work when I switch back to Debug. Is there a way to get around this or do I just have to save my release compilation until the very end and add the 'L' macro to all of these functions? Also, does anybody know the reason Microsoft did this? Thanks, Dustin
For all string literals in your code, you should use the _T("xxx") macro. For unicode builds, _T() is replaced by 'L', whereas for non-unicode builds it gets replaced by white space. So, literals end up correctly defined automatically, regardless of the build. Mike
-
For all string literals in your code, you should use the _T("xxx") macro. For unicode builds, _T() is replaced by 'L', whereas for non-unicode builds it gets replaced by white space. So, literals end up correctly defined automatically, regardless of the build. Mike
Thanks for the advice.