I'm a bit of a newbie to implementing unicode into my software, I've used version.h before to grab the version number of my program, but this no longer compiles with my unicode MFC app.
Has anyone converted version.h to unicode, or does anyone know what I have to do to easily fix this please?
Perhaps there is another way to grab my current version number?
Here are the compiler errors:
Code:
1>version.h(37) : error C2440: 'initializing' : cannot convert from 'const char [1]' to 'TCHAR [260]'
1> There is no context in which this conversion is possible
1>version.h(41) : error C2440: 'initializing' : cannot convert from 'TCHAR [260]' to 'std::basic_string<_Elem,_Traits,_Ax>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>version.h(47) : error C2664: 'GetFileVersionInfoSizeW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>version.h(56) : error C2664: 'GetFileVersionInfoW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>version.h(64) : error C2664: 'VerQueryValueW' : cannot convert parameter 2 from 'const char [25]' to 'LPWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>version.h(119) : error C2440: 'const_cast' : cannot convert from 'const char *' to 'LPTSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>version.h(122) : error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it)' : cannot convert parameter 1 from 'LPTSTR' to 'std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> Constructor for struct 'std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it' is declared 'explicit'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
Unicode is bit boaring for the programming purpose. U need to convert all string variables into unicode format e.g char buf[80] -> TCHAR buf[80]. U need to use unicode specific functions that u will find on net. e.g fopen -> _tfopen etc.
u will need to load strings from string table to serve the purpose of using unicode.
I'm writing a subcaptioning system for DCI compliant digital cinema projectors (the ones that play the 3D movies). I used version.h to interrogate the version string information in my source code, but I can't get it to compile because of unicode.
I need unicode to support languages worldwide.
Version.h uses std::string, and I don't know how to use this with unicode.
[...] U need to convert all string variables into unicode format e.g char buf[80] -> TCHAR buf[80]. U need to use unicode specific functions that u will find on net. e.g fopen -> _tfopen etc.
Neither TCHAR buf[80] is a "string vartiable in unicode format", nor _tfopen is "unicode specific function".
Both ar just macros, defined in TCHAR.H.
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::_Fillobj<_Elem>' (or there is no acceptable conversion) version.h 115
error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(const _Elem *)' : cannot convert parameter 1 from 'LPTSTR' to 'const char *' version.h 123
Bookmarks