windows - compiling BUTT with mingw64 cannot convert 'char*' to ' LPWSTR {aka wchar_t*}' in assignment -
i'm trying compile butt (http://butt.sourceforge.net/) on windows mingww64. seem running errors of type error: cannot convert 'char*' 'lpcwstr {aka const wchar_t*}'
most. there simple option enabling unicode missing? can see options being passed g++ @ top of paste.
0_0@0_0-pc /z/src/butt-0.1.12 $ make make -c src check ../config.mk ... ok. make[1]: entering directory `/z/src/butt-0.1.12/src' g++ -i/usr/local/include -i/usr/local/include -i/usr/local/include -i. -i/usr/ local/include -wall -o2 -dversion=\"butt-0.1.12\" `` -ifltk -i/usr/local/includ e -i/usr/local/include/fl/images -mwindows -dwin32 -duse_opengl32 -d_largefile_s ource -d_largefile64_source -d_file_offset_bits=64 -dfltk1 -dhave_fltk -ilibvorb -dhave_libvorbis -iliblame -dhave_liblame -c -o fltk/fl_native_file_cho oser.o fltk/fl_native_file_chooser.cpp in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx: in member function 'void fl_native_file_c hooser::clearofn()': fltk/fl_native_file_chooser_win32.cxx:244:24: error: cannot convert 'char*' ' lpwstr {aka wchar_t*}' in assignment _ofn.lpstrfile = strfree((char*)_ofn.lpstrfile); ^ fltk/fl_native_file_chooser_win32.cxx:247:30: error: cannot convert 'lpcstr {aka const char*}' 'lpcwstr {aka const wchar_t*}' in assignment _ofn.lpstrinitialdir = (lpcstr)strfree((char*)_ofn.lpstrinitialdir); ^ fltk/fl_native_file_chooser_win32.cxx: in member function 'int fl_native_file_ch ooser::showfile()': fltk/fl_native_file_chooser_win32.cxx:312:23: error: cannot convert 'char*' ' lpwstr {aka wchar_t*}' in assignment _ofn.lpstrfile = new char[fsize]; ^ fltk/fl_native_file_chooser_win32.cxx:319:21: error: cannot convert 'char*' ' lpcwstr {aka const wchar_t*}' in assignment _ofn.lpstrtitle = _title ? _title : null; ^ fltk/fl_native_file_chooser_win32.cxx:321:22: error: cannot convert 'char*' ' lpcwstr {aka const wchar_t*}' in assignment _ofn.lpstrfilter = _parsedfilt ? _parsedfilt : null; ^ fltk/fl_native_file_chooser_win32.cxx:333:53: error: cannot convert 'lpwstr {aka wchar_t*}' 'char*' argument '1' 'char* strncpy(char*, const char*, si ze_t)' strncpy(_ofn.lpstrfile, _preset_file, _ofn.nmaxfile); ^ fltk/fl_native_file_chooser_win32.cxx:334:25: error: no matching function ca ll 'fl_native_file_chooser::unix2win(wchar*&)' unix2win(_ofn.lpstrfile); ^ fltk/fl_native_file_chooser_win32.cxx:334:25: note: candidate is: fltk/fl_native_file_chooser_win32.cxx:42:20: note: void fl_native_file_chooser:: unix2win(char*) #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:272:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::unix2win(char *s) { ^ fltk/fl_native_file_chooser_win32.cxx:42:20: note: no known conversion arg ument 1 'lpwstr {aka wchar_t*}' 'char*' #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:272:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::unix2win(char *s) { ^ fltk/fl_native_file_chooser_win32.cxx:343:23: error: cannot convert 'char*' ' lpcwstr {aka const wchar_t*}' in assignment _ofn.lpstrinitialdir = strnew(_directory); ^ fltk/fl_native_file_chooser_win32.cxx:352:41: error: cannot convert 'char*' ' lpwstr {aka wchar_t*}' argument '2' 'dword getcurrentdirectoryw(dword, lp wstr)' getcurrentdirectory(max_path, oldcwd); ^ fltk/fl_native_file_chooser_win32.cxx:372:45: error: cannot convert 'char*' ' lpcwstr {aka const wchar_t*}' argument '1' 'winbool setcurrentdirectoryw( lpcwstr)' if ( oldcwd[0] ) setcurrentdirectory(oldcwd); ^ fltk/fl_native_file_chooser_win32.cxx:377:35: error: cannot convert 'char*' ' lpcwstr {aka const wchar_t*}' argument '1' 'winbool setcurrentdirectoryw( lpcwstr)' setcurrentdirectory(oldcwd); ^ fltk/fl_native_file_chooser_win32.cxx:383:40: error: no matching function ca ll 'fl_native_file_chooser::set_single_pathname(wchar*&)' set_single_pathname(_ofn.lpstrfile); ^ fltk/fl_native_file_chooser_win32.cxx:383:40: note: candidate is: fltk/fl_native_file_chooser_win32.cxx:42:20: note: void fl_native_file_chooser:: set_single_pathname(const char*) #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:208:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::set_single_pathname(const char *s) { ^ fltk/fl_native_file_chooser_win32.cxx:42:20: note: no known conversion arg ument 1 'lpwstr {aka wchar_t*}' 'const char*' #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:208:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::set_single_pathname(const char *s) { ^ fltk/fl_native_file_chooser_win32.cxx:388:33: error: cannot convert 'lpwstr {aka wchar_t*}' 'const char*' in initialization const char *dirname = _ofn.lpstrfile; ^ fltk/fl_native_file_chooser_win32.cxx:395:51: error: cannot convert 'lpwstr {aka wchar_t*}' 'const char*' in initialization ( const char *s = _ofn.lpstrfile + dirlen + 1; ^ fltk/fl_native_file_chooser_win32.cxx: in member function 'int fl_native_file_ch ooser::showdir()': fltk/fl_native_file_chooser_win32.cxx:460:21: error: cannot convert 'char*' ' lpcwstr {aka const wchar_t*}' in assignment _binf.lpsztitle = _title ? _title : null; ^ fltk/fl_native_file_chooser_win32.cxx:483:26: error: cannot convert 'char [260]' 'lpwstr {aka wchar_t*}' in assignment _binf.pszdisplayname = displayname; ^ in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx:504:22: error: no matching function ca ll 'fl_native_file_chooser::win2unix(tchar [260])' win2unix(path); ^ fltk/fl_native_file_chooser_win32.cxx:504:22: note: candidate is: in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx:42:20: note: void fl_native_file_chooser:: win2unix(char*) #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:266:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::win2unix(char *s) { ^ fltk/fl_native_file_chooser_win32.cxx:42:20: note: no known conversion arg ument 1 'tchar [260] {aka wchar_t [260]}' 'char*' #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:266:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::win2unix(char *s) { ^ in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx:505:19: error: no matching function ca ll 'fl_native_file_chooser::add_pathname(tchar [260])' add_pathname(path); ^ fltk/fl_native_file_chooser_win32.cxx:505:19: note: candidate is: in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx:42:20: note: void fl_native_file_chooser:: add_pathname(const char*) #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:216:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::add_pathname(const char *s) { ^ fltk/fl_native_file_chooser_win32.cxx:42:20: note: no known conversion arg ument 1 'tchar [260] {aka wchar_t [260]}' 'const char*' #define fnfc_class fl_native_file_chooser ^ fltk/fl_native_file_chooser_win32.cxx:216:6: note: in expansion of macro 'fnfc_c lass' void fnfc_class::add_pathname(const char *s) { ^ in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx:508:22: error: cannot convert 'tchar* {aka wchar_t*}' 'const char*' argument '1' 'size_t strlen(const char*)' if ( !strlen(path) ) return(1); // don't return empty pathnames ^ fltk/fl_native_file_chooser_win32.cxx: in member function 'void fl_native_file_c hooser::add_filter(const char*, const char*)': fltk/fl_native_file_chooser_win32.cxx:617:56: warning: field precision specifier '.*' expects argument of type 'int', argument 3 has type 'long long unsigne d int' [-wformat=] sprintf(name, "%.*s files", sizeof(name)-10, winfilter); ^ fltk/fl_native_file_chooser_win32.cxx:619:55: warning: field precision specifier '.*' expects argument of type 'int', argument 3 has type 'long long unsigne d int' [-wformat=] sprintf(name, "%.*s", sizeof(name)-10, name_in); ^ in file included fltk/fl_native_file_chooser_win32.cxx:35:0, fltk/fl_native_file_chooser.cpp:26: fltk/fl_native_file_chooser_common.cxx: @ global scope: fltk/fl_native_file_chooser_common.cxx:60:14: warning: 'char* strapp(char*, cons t char*)' defined not used [-wunused-function] static char *strapp(char *s, const char *val) { ^ in file included fltk/fl_native_file_chooser.cpp:26:0: fltk/fl_native_file_chooser_win32.cxx:61:13: warning: 'void dnullprint(char*)' d efined not used [-wunused-function] static void dnullprint(char *wp) { ^ <builtin>: recipe target `fltk/fl_native_file_chooser.o' failed make[1]: *** [fltk/fl_native_file_chooser.o] error 1 make[1]: leaving directory `/z/src/butt-0.1.12/src' makefile:48: recipe target `butt' failed make: *** [butt] error 2
here first function contains of errors:
// clear microsoft ofn (open file name) class void fnfc_class::clearofn() { // free allocated lpstrfile before zeroing out _ofn if ( _ofn.lpstrfile ) { _ofn.lpstrfile = strfree((char*)_ofn.lpstrfile); } if ( _ofn.lpstrinitialdir ) { _ofn.lpstrinitialdir = (lpcstr)strfree((char*)_ofn.lpstrinitialdir); } _ofn.lpstrfilter = null; // (deleted elsewhere) int temp = _ofn.nfilterindex; // keep filter_value memset((void*)&_ofn, 0, sizeof(_ofn)); _ofn.lstructsize = sizeof(openfilename); _ofn.nfilterindex = temp; } ^
chances butt not designed unicode, calling win32 api functions tchar
-aware use unicode when unicode
/_unicode
defined during compiling, , use ansi otherwise. either go project setting , turn off unicode such api functions use ansi instead, or else update butt's code tchar
-aware can convert between char*
, wchar_t*
when appropriate.
Comments
Post a Comment