Sunday, August 09, 2015

How to Setup wxWidgets 3.0.2 with Netbeans 8.0.2 and Linux GCC

Nebeans is great software to code the program in many language and platform. Java is the base language supported by netbeans, but it can be used to code in wide range language/framework like C++, PHP and HTML. This page will guide you to configure wxWidgets-3.0.2 in Ubuntu 14.0.4.

Workspace and pre-requisities:
Create New C++ Project



Create Intial Class MyApp (MyApp.cpp)
/***************************************************************
 * Name:      MyApp.cpp
 * Purpose:   Code for Application Class
 * Author:    Dedy Yasriady (yasriady@yahoo.com)
 * Created:   2014-04-20
 * Copyright: Dedy Yasriady (http://yasriady.blogspot.com)
 * License:
 **************************************************************/

#include 
#include 

class MyApp: public wxApp {

public:
    MyApp() {}
    virtual ~MyApp() {}
    virtual bool OnInit();
    virtual int OnExit() { return 0; }

};

IMPLEMENT_APP (MyApp);

inline bool MyApp::OnInit() {
    //Init main Frame
    wxFrame* mainFrame = new UIMainFrame(NULL);
    mainFrame->Show(true);
    SetTopWindow(mainFrame);

    return true;
}
Create Form or GUI using wxFormBuilder

Get the flle here: UI.fbp
 
Configure C++ Compiler
On additional "Additional Options" set the value as following:
For debug version:
/opt/wxWidgets/wxWidgets-3.0.2/build2/wx3.0.2ud_static/wx-config --cxxflags
For release version:
/opt/wxWidgets/wxWidgets-3.0.2/build2/wx3.0.2u_static/wx-config --cxxflags

Configure Linker

Set "Additional Options" as follow:
For debug version:
/opt/wxWidgets/wxWidgets-3.0.2/build2/wx3.0.2ud_static/wx-config --libs
For release version:
/opt/wxWidgets/wxWidgets-3.0.2/build2/wx3.0.2u_static/wx-config --libs

Finish, it's so simple. Run the program [F6] and take a look the result similar to image below:

For those impatient, please download complete Project file here. Happy coding....

0 comments: