Author Topic: Newbie problem  (Read 9366 times)

Offline matpaz

  • Single posting newcomer
  • *
  • Posts: 2
Newbie problem
« on: February 12, 2010, 06:45:52 pm »
Hi all,

  I have a problem, (i'm newbie). I installed WxWidgets 2.8.8, and Code::Blocks 8.02 (from Vector Linux 6 repo), and made the hello example (like in the wiki), but i have compile errors, and i think i have to set something else that i didn't. I made 4 try with WxSmith (Frame Based):

1- WxWidgets Lib / advanced options /use unicode build


-------------------------------------------------------------------------------------------------------------------------------------------
Compiling: hello1Main.cpp
In file included from <command-line>:0:
./wx_pch.h:14:23: error: wx/wxprec.h: No such file or directory
In file included from /home/master/hello1/hello1Main.cpp:11:
/home/master/hello1/hello1Main.h:14:22: error: wx/sizer.h: No such file or directory
/home/master/hello1/hello1Main.h:15:25: error: wx/stattext.h: No such file or directory
/home/master/hello1/hello1Main.h:16:21: error: wx/menu.h: No such file or directory
/home/master/hello1/hello1Main.h:17:22: error: wx/panel.h: No such file or directory
/home/master/hello1/hello1Main.h:18:23: error: wx/button.h: No such file or directory
/home/master/hello1/hello1Main.h:19:22: error: wx/frame.h: No such file or directory
/home/master/hello1/hello1Main.h:20:25: error: wx/statusbr.h: No such file or directory
/home/master/hello1/hello1Main.cpp:12:23: error: wx/msgdlg.h: No such file or directory
/home/master/hello1/hello1Main.cpp:15:21: error: wx/intl.h: No such file or directory
/home/master/hello1/hello1Main.cpp:16:23: error: wx/string.h: No such file or directory
In file included from /home/master/hello1/hello1Main.cpp:11:
/home/master/hello1/hello1Main.h:24: error: expected class-name before '{' token
/home/master/hello1/hello1Main.h:27: error: expected `)' before '*' token
/home/master/hello1/hello1Main.h:33: error: 'wxCommandEvent' has not been declared
/home/master/hello1/hello1Main.h:34: error: 'wxCommandEvent' has not been declared
/home/master/hello1/hello1Main.h:35: error: 'wxCommandEvent' has not been declared
/home/master/hello1/hello1Main.h:48: error: ISO C++ forbids declaration of 'wxButton' with no type
/home/master/hello1/hello1Main.h:48: error: expected ';' before '*' token
/home/master/hello1/hello1Main.h:49: error: ISO C++ forbids declaration of 'wxPanel' with no type
/home/master/hello1/hello1Main.h:49: error: expected ';' before '*' token
/home/master/hello1/hello1Main.h:50: error: ISO C++ forbids declaration of 'wxStaticText' with no type
/home/master/hello1/hello1Main.h:50: error: expected ';' before '*' token
/home/master/hello1/hello1Main.h:51: error: ISO C++ forbids declaration of 'wxStatusBar' with no type
/home/master/hello1/hello1Main.h:51: error: expected ';' before '*' token
/home/master/hello1/hello1Main.h:54: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
/home/master/hello1/hello1Main.h:55: error: expected ';' before '}' token
/home/master/hello1/hello1Main.h:55: error: expected `;' before '}' token
/home/master/hello1/hello1Main.cpp:23: error: 'wxString' does not name a type
/home/master/hello1/hello1Main.cpp:46: error: 'wxNewId' was not declared in this scope
/home/master/hello1/hello1Main.cpp:47: error: 'wxNewId' was not declared in this scope
/home/master/hello1/hello1Main.cpp:48: error: 'wxNewId' was not declared in this scope
/home/master/hello1/hello1Main.cpp:49: error: 'wxNewId' was not declared in this scope
/home/master/hello1/hello1Main.cpp:50: error: 'wxNewId' was not declared in this scope
/home/master/hello1/hello1Main.cpp:51: error: 'wxNewId' was not declared in this scope
/home/master/hello1/hello1Main.cpp:54: error: 'wxFrame' has not been declared
/home/master/hello1/hello1Main.cpp:57: error: expected constructor, destructor, or type conversion before 'END_EVENT_TABLE'
Process terminated with status 1 (0 minutes, 0 seconds)
36 errors, 0 warnings
-------------------------------------------------------------------------------------------------------------------------------------------


2- WxWidgets Lib / advanced options /use dynamic


-------------------------------------------------------------------------------------------------------------------------------------------
Compiling: hello2Main.cpp
In file included from /usr/include/wx-2.8/wx/wx.h:21,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/hashmap.h: In member function 'wxLongToLongHashMap_wxImplementation_HashTable::Node** wxLongToLongHashMap_wxImplementation_HashTable::GetNodePtr(const long int&) const':
/usr/include/wx-2.8/wx/hashmap.h:737: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/event.h:18,
                 from /usr/include/wx-2.8/wx/wx.h:25,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/clntdata.h: In member function 'wxShadowObjectMethods_wxImplementation_HashTable::Node** wxShadowObjectMethods_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/clntdata.h:20: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/clntdata.h: In member function 'wxShadowObjectFields_wxImplementation_HashTable::Node** wxShadowObjectFields_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/clntdata.h:25: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/event.h:21,
                 from /usr/include/wx-2.8/wx/wx.h:25,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/gdicmn.h: In member function 'wxStringToColourHashMap_wxImplementation_HashTable::Node** wxStringToColourHashMap_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/gdicmn.h:544: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/wx.h:45,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/image.h: In member function 'wxImageHistogramBase_wxImplementation_HashTable::Node** wxImageHistogramBase_wxImplementation_HashTable::GetNodePtr(const long unsigned int&) const':
/usr/include/wx-2.8/wx/image.h:136: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/unistd.h: In member function 'void hello2Frame::OnButton1Click(wxCommandEvent&)':
/usr/include/unistd.h:320: error: too few arguments to function 'int close(int)'
/home/master/hello2/hello2Main.cpp:120: error: at this point in file
Process terminated with status 1 (0 minutes, 2 seconds)
2 errors, 5 warnings
-------------------------------------------------------------------------------------------------------------------------------------------


3- WxWidgets Lib / advanced options /use dynamic + unicode


-------------------------------------------------------------------------------------------------------------------------------------------
Compiling: hello3Main.cpp
In file included from /usr/include/wx-2.8/wx/wx.h:21,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/hashmap.h: In member function 'wxLongToLongHashMap_wxImplementation_HashTable::Node** wxLongToLongHashMap_wxImplementation_HashTable::GetNodePtr(const long int&) const':
/usr/include/wx-2.8/wx/hashmap.h:737: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/event.h:18,
                 from /usr/include/wx-2.8/wx/wx.h:25,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/clntdata.h: In member function 'wxShadowObjectMethods_wxImplementation_HashTable::Node** wxShadowObjectMethods_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/clntdata.h:20: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/clntdata.h: In member function 'wxShadowObjectFields_wxImplementation_HashTable::Node** wxShadowObjectFields_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/clntdata.h:25: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/event.h:21,
                 from /usr/include/wx-2.8/wx/wx.h:25,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/gdicmn.h: In member function 'wxStringToColourHashMap_wxImplementation_HashTable::Node** wxStringToColourHashMap_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/gdicmn.h:544: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/wx.h:45,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/image.h: In member function 'wxImageHistogramBase_wxImplementation_HashTable::Node** wxImageHistogramBase_wxImplementation_HashTable::GetNodePtr(const long unsigned int&) const':
/usr/include/wx-2.8/wx/image.h:136: warning: dereferencing type-punned pointer will break strict-aliasing rules
Process terminated with status 0 (0 minutes, 3 seconds)
0 errors, 5 warnings
-------------------------------------------------------------------------------------------------------------------------------------------


4- WxWidgets Default option


-------------------------------------------------------------------------------------------------------------------------------------------
Compiling: hello4Main.cpp
In file included from /usr/include/wx-2.8/wx/wx.h:21,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/hashmap.h: In member function 'wxLongToLongHashMap_wxImplementation_HashTable::Node** wxLongToLongHashMap_wxImplementation_HashTable::GetNodePtr(const long int&) const':
/usr/include/wx-2.8/wx/hashmap.h:737: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/event.h:18,
                 from /usr/include/wx-2.8/wx/wx.h:25,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/clntdata.h: In member function 'wxShadowObjectMethods_wxImplementation_HashTable::Node** wxShadowObjectMethods_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/clntdata.h:20: warning: dereferencing type-punned pointer will break strict-aliasing rules
/usr/include/wx-2.8/wx/clntdata.h: In member function 'wxShadowObjectFields_wxImplementation_HashTable::Node** wxShadowObjectFields_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/clntdata.h:25: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/event.h:21,
                 from /usr/include/wx-2.8/wx/wx.h:25,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/gdicmn.h: In member function 'wxStringToColourHashMap_wxImplementation_HashTable::Node** wxStringToColourHashMap_wxImplementation_HashTable::GetNodePtr(const wxString&) const':
/usr/include/wx-2.8/wx/gdicmn.h:544: warning: dereferencing type-punned pointer will break strict-aliasing rules
In file included from /usr/include/wx-2.8/wx/wx.h:45,
                 from /usr/include/wx-2.8/wx/wxprec.h:68,
                 from ./wx_pch.h:14,
                 from <command-line>:0:
/usr/include/wx-2.8/wx/image.h: In member function 'wxImageHistogramBase_wxImplementation_HashTable::Node** wxImageHistogramBase_wxImplementation_HashTable::GetNodePtr(const long unsigned int&) const':
/usr/include/wx-2.8/wx/image.h:136: warning: dereferencing type-punned pointer will break strict-aliasing rules
Process terminated with status 0 (0 minutes, 3 seconds)
0 errors, 5 warnings
-------------------------------------------------------------------------------------------------------------------------------------------


I'm sure i made i mistake, but don't understand which is, wrong WxWidgets install? wrong Code::Blocks install? wrong settings?

Hope someone knows it.

Thanks, Bye all

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Newbie problem
« Reply #1 on: February 12, 2010, 07:06:55 pm »
Do you have wxWidgets development package installed ?

I don't know how it is called on vector linux, but should be something like libwx*-dev or wxgtk-devel .

Offline matpaz

  • Single posting newcomer
  • *
  • Posts: 2
Re: Re: Newbie problem
« Reply #2 on: February 12, 2010, 10:04:24 pm »
Hello Jens,

  Thanks for the reply. Anyway i think i din't understand something: the error in my post happen when i create a "Release" configuration, but if i create a "Debug" configuration, with standard WxWidgets library set in the WxSmith dialog at project creation, it works, and  compile without errors, instead if i create a "Debug" configuration, with dynamic WxWidgets library it gives the same errors. Is there any difference between "Debug" and "Release" configuration related to the Wx library link?
Anyway i think i'll install WxWidgets 2.8.10 full from their site, cause apart the difference regarding Debug & Release configuration (that i don't know), i think that the library from VectorLinux repo should be incomplete (at least lookin inside the archive).

Thanks Again, Regards

Offline greenbreen

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Newbie problem
« Reply #3 on: January 23, 2011, 05:49:42 pm »
I know this is an old thread, but I recently had a similar problem, and I stumbled upon this thread in looking for a solution.  I ended up having to figure it out myself, so I thought I'd post the resolution here.  I'm using code::blocks 8.02 on Ubuntu 10.04.  When I started a new wxWidgets project and checked the "Use Advanced Options" box during initial setup, the skeleton code would fail to compile, giving "./wx_pch.h:14:23: error: wx/wxprec.h: No such file or directory".  If I unchecked the Advanced Option, it worked.  If found that under "Project->Build options->Compiler settings->Other options", `wx-config --cflags` was listed when it compiled, but it was not listed when it didn't compile.  Likewise, `wx-config --libs` needed to be present under "Project->Build options->Linker settings->Other linker options" for it to link properly.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Newbie problem
« Reply #4 on: January 23, 2011, 08:10:07 pm »
If you use advanced options, there is a difference between releas and debug target, so the wx-config lines are on target and not on project level.

The second point is, that you should know what you do, if you use advanced options: be sure you have an appropriate wx installation, e.g. non-unicode (ansi) and probably static build (no dynamic libs), otherwise the build fails (of course).