first program in vim

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
guzzi_jones
Experienced Solver
Experienced Solver
Posts: 81
Joined: Sun Dec 08, 2013 3:50 am

first program in vim

Post by guzzi_jones » Sun Dec 22, 2013 12:52 am

I am attempting to compile my first program in vim on ubuntu using wxwidgets 2.8.
I have written the following program:
#include <wx/app.h>
2 #include <wx/msgdlg.h>
3 #include <wx/intl.h>
4 #include <wx/string.h>
5 #include <wx/wx.h>
6
7
8 class OurApp : public wxApp
9 {
10 bool OnInit()
11 {
12
13 }
14
15 };
16
17 #include <wx/wx.h>
18 wxFrame* Frame = new wxFrame(NULL, wxID_ANY, wxString("our First App",wxConvUTF8));
19
20
21 IMPLEMENT_APP(OurApp);


here is my compile string
g++ ourappmain.cpp -o ourappmain.o `/usr/bin/wx-config --cppflags`



Here is the errors:
/tmp/ccwGfw3g.o: In function `wxCreateApp()':
ourappmain.cpp:(.text+0x18): undefined reference to `wxAppConsole::CheckBuildOptions(char const*, char const*)'
/tmp/ccwGfw3g.o: In function `main':
ourappmain.cpp:(.text+0x73): undefined reference to `wxEntry(int&, char**)'
/tmp/ccwGfw3g.o: In function `__static_initialization_and_destruction_0(int, int)':
ourappmain.cpp:(.text+0xc4): undefined reference to `wxStringBase::npos'
ourappmain.cpp:(.text+0xc9): undefined reference to `wxConvUTF8'
ourappmain.cpp:(.text+0xe4): undefined reference to `wxString::wxString(char const*, wxMBConv const&, unsigned int)'
ourappmain.cpp:(.text+0xef): undefined reference to `wxFrameNameStr'
ourappmain.cpp:(.text+0x11f): undefined reference to `wxDefaultSize'
ourappmain.cpp:(.text+0x127): undefined reference to `wxDefaultPosition'
/tmp/ccwGfw3g.o: In function `wxStringBase::wxStringBase(wchar_t const*)':
ourappmain.cpp:(.text._ZN12wxStringBaseC2EPKw[_ZN12wxStringBaseC5EPKw]+0x7): undefined reference to `wxStringBase::npos'


Thanks for all your help!

guzzi_jones
Experienced Solver
Experienced Solver
Posts: 81
Joined: Sun Dec 08, 2013 3:50 am

Re: first program in vim

Post by guzzi_jones » Sun Dec 22, 2013 1:12 am

this compiles string got it to compile for me:
gcc *.cpp -o ourappmain.o `/usr/bin/wx-config --libs --cppflags`

I am walking through this tutorial and learning a lot.
http://hosannahighertech.co.tz/forums/s ... php?tid=68

I am getting so frustrated in codeblocks. I am a vim guy so this tutorial is very helpful.

guzzi_jones
Experienced Solver
Experienced Solver
Posts: 81
Joined: Sun Dec 08, 2013 3:50 am

Re: first program in vim

Post by guzzi_jones » Sun Dec 22, 2013 1:19 am

Now when I try and run the program this is what I get:

$ ./ourappmain.o
(process:4618): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.32.4/./gobject/gtype.c:2722: You forgot to call g_type_init()

guzzi_jones
Experienced Solver
Experienced Solver
Posts: 81
Joined: Sun Dec 08, 2013 3:50 am

Re: first program in vim

Post by guzzi_jones » Sun Dec 22, 2013 3:44 am

This worked with above compiles string
#include <wx/app.h>
2 #include <wx/wx.h>
3 #include <wx/msgdlg.h>
4 #include <wx/intl.h>
5
6 #include <wx/string.h>
7
8 //*)
9
10 class OurApp : public wxApp
11 {
12 bool OnInit();
13
14
15
16 };
17 bool OurApp::OnInit(){
18 wxFrame* frame = new wxFrame(NULL, wxID_ANY, _("Our First App"));
19 frame->Show();
20 return true;
21
22 }
23
24 IMPLEMENT_APP(OurApp);

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: first program in vim

Post by DavidHart » Sun Dec 22, 2013 7:53 am

Hi,
I am attempting to compile my first program in vim on ubuntu using wxwidgets 2.8.
You've got it working now but, FYI and for others reading this in the future:
  • The wx source packages come with many working sample programs in the samples/ dir. The best place to start is 'minimal'.
    If you use a debianish distro and their wx debs, the samples are in the wx*-examples package which installs to /usr/share/doc/wx-examples/.
BTW, when you paste lumps of code here, please put them inside 'Code' tags; it makes posts much more readable.

Regards,

David

Post Reply