c++ - wxWidgets Hello World example not compiling -


i'm trying learn wxwidgets framework i've been assigned work on project uses library.

i using on raspberry pi, having installed using sudo apt-get install libwxgtk2.8-dev libwxgtk2.8-dbg.

i found this tutorial on wxwidgets website , pasted file called hello.cpp on pi.

then ran g++ hello.cpp -o hellowx-config --cxxflags --libs` , got following enormous error message:

 gcc hello.cpp -o hello `wx-config --cxxflags --libs` hello.cpp:20:27: error: iso c++ forbids declaration of ‘wxdeclare_event_table’ no type [-fpermissive] hello.cpp:27:5: error: expected constructor, destructor, or type conversion before ‘wxeventtableentry’ hello.cpp: in member function ‘virtual bool myapp::oninit()’: hello.cpp:34:84: error: conversion ‘const char [12]’ ‘const wxstring’ ambiguous hello.cpp:34:84: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [12]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [12]’ ‘int’ hello.cpp:15:5: error:   initializing argument 1 of ‘myframe::myframe(const wxstring&, const wxpoint&, const wxsize&)’ hello.cpp: in constructor ‘myframe::myframe(const wxstring&, const wxpoint&, const wxsize&)’: hello.cpp:43:74: error: conversion ‘const char [17]’ ‘const wxstring’ ambiguous hello.cpp:43:74: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [17]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [17]’ ‘int’ /usr/include/wx-2.8/wx/menu.h:62:17: error:   initializing argument 2 of ‘wxmenuitem* wxmenubase::append(int, const wxstring&, const wxstring&, wxitemkind)’ hello.cpp:49:40: error: conversion ‘const char [6]’ ‘const wxstring’ ambiguous hello.cpp:49:40: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [17]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [17]’ ‘int’ /usr/include/wx-2.8/wx/menu.h:62:17: error:   initializing argument 2 of ‘wxmenuitem* wxmenubase::append(int, const wxstring&, const wxstring&, wxitemkind)’ hello.cpp:49:40: error: conversion ‘const char [6]’ ‘const wxstring’ ambiguous hello.cpp:49:40: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  hello.cpp:20:27: error: iso c++ forbids declaration of ‘wxdeclare_event_table’ no type [-fpermissive] hello.cpp:27:5: error: expected constructor, destructor, or type conversion before ‘wxeventtableentry’ hello.cpp: in member function ‘virtual bool myapp::oninit()’: hello.cpp:34:84: error: conversion ‘const char [12]’ ‘const wxstring’ ambiguous hello.cpp:34:84: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [12]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [12]’ ‘int’ hello.cpp:15:5: error:   initializing argument 1 of ‘myframe::myframe(const wxstring&, const wxpoint&, const wxsize&)’ hello.cpp: in constructor ‘myframe::myframe(const wxstring&, const wxpoint&, const wxsize&)’: hello.cpp:43:74: error: conversion ‘const char [17]’ ‘const wxstring’ ambiguous hello.cpp:43:74: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [17]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [17]’ ‘int’ /usr/include/wx-2.8/wx/menu.h:62:17: error:   initializing argument 2 of ‘wxmenuitem* wxmenubase::append(int, const wxstring&, const wxstring&, wxitemkind)’ hello.cpp:49:40: error: conversion ‘const char [6]’ ‘const wxstring’ ambiguous hello.cpp:49:40: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [6]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [6]’ ‘int’ /usr/include/wx-2.8/wx/gtk/menu.h:27:18: error:   initializing argument 2 of ‘virtual bool wxmenubar::append(wxmenu*, const wxstring&)’ hello.cpp:50:40: error: conversion ‘const char [6]’ ‘const wxstring’ ambiguous hello.cpp:50:40: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [6]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [6]’ ‘int’ /usr/include/wx-2.8/wx/gtk/menu.h:27:18: error:   initializing argument 2 of ‘virtual bool wxmenubar::append(wxmenu*, const wxstring&)’ hello.cpp:53:44: error: conversion ‘const char [22]’ ‘const wxstring’ ambiguous hello.cpp:53:44: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [22]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [22]’ ‘int’ /usr/include/wx-2.8/wx/frame.h:110:18: error:   initializing argument 1 of ‘virtual void wxframebase::setstatustext(const wxstring&, int)’ hello.cpp: in member function ‘void myframe::onabout(wxcommandevent&)’: hello.cpp:62:66: error: conversion ‘const char [40]’ ‘const wxstring’ ambiguous hello.cpp:62:66: note: candidates are: /usr/include/wx-2.8/wx/string.h:692:3: note: wxstring::wxstring(wxchar, size_t)  /usr/include/wx-2.8/wx/string.h:692:3: note:   no known conversion argument 1 ‘const char [40]’ ‘wxchar {aka wchar_t}’ /usr/include/wx-2.8/wx/string.h:682:3: note: wxstring::wxstring(int)  /usr/include/wx-2.8/wx/string.h:682:3: note:   no known conversion argument 1 ‘const char [40]’ ‘int’ /usr/include/wx-2.8/wx/msgdlg.h:70:17: error:   initializing argument 1 of ‘int wxmessagebox(const wxstring&, const wxstring&, long int, wxwindow*, int, int)’ hello.cpp: in member function ‘void myframe::onhello(wxcommandevent&)’: hello.cpp:66:47: error: cannot convert ‘const char*’ ‘const wxchar* {aka const wchar_t*}’ argument ‘1’ ‘void wxlogmessage(const wxchar*, ...)’ 

it seems issues around converting char* types wxstring types. there way resolve this? seems strange official example have these errors, compiling properly?

you linked documentation of trunk version of wxwidgets. in wxstring, there changes since 2.8 3.0.

see http://docs.wxwidgets.org/trunk/overview_changes_since28.html

so suggest use page "hello world" programm. http://docs.wxwidgets.org/2.8.12/wx_helloworld.html#helloworld

i suggest too, use "g++" instead of "gcc". g++ links automaticlly libstdc++. what difference between g++ , gcc?


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -