Menu

Application Using wxWidgets

Nick Chang
2009-01-31
2012-09-26
  • Nick Chang

    Nick Chang - 2009-01-31

    ey all,

    I have been using wxDev-cpp for some months now, and liked it. However, recently, I came to know of the wxWidgets framework, and today, tried out compiling the code in wxDev-cpp.

    Now the thing is, I want it to just compile a single cpp file to form an application, and I DON'T want a visual interface. I DON'T want multiple settings that have to be read up on to use. All I want it to do is to compile a cpp file that I have written completely.

    Now I have the (?) latest version [7.0 rc3], and I tried to compile a simple skeleton application:

    include <wx/wx.h>

    class BasicApp : wxApp
    {
    public:
    BasicApp();
    virtual bool OnInit();
    private:
    wxFrame* frame;
    };

    DECLARE_APP(BasicApp)
    IMPLEMENT_APP(BasicApp)

    BasicApp::BasicApp()
    {
    frame = new wxFrame(NULL, -1, "Hey There!");
    }

    bool BasicApp::OnInit()
    {
    frame->Show(true);
    return true;
    }

    I got the following errors:

    hello.cpp: In function wxAppConsole* wxCreateApp()': hello.cpp:13: error:wxAppConsole' is an inaccessible base of `BasicApp'

    hello.cpp: In function `BasicApp& wxGetApp()':

    hello.cpp:13: error: wxAppConsole' is an inaccessible base ofBasicApp'

    mingw32-make.exe: *** [Objects/MingW/hello.o] Error 1[/code]

    Can anyone offer some advice?

    PS. I used 'Emty wxWidgets Project' for the project.

     
    • cpns

      cpns - 2009-02-02

      > Is wxWidgets integrated into VisualC++?
      > I thought it used MFCs, so abandoned it.

      It is a compiler, it is a matter of whether wxWidgets supports VC++ not the other way around. VC++ Express (which is free) does not have MFC, it only supports the .NET framework and Windows Forms for GUI development. Bit that is just a matter of what is included. Nothing stops you from adding additional libraries.

      You have checked out the wxwidgets.org web-site right?

      > I was wondering if you knew any compilers that
      > could compile a stand-alone source-file?

      That would be any compiler! I think I mentioned VC++ Express more than once! Don't get mixed up between a compiler and an IDE.

      > Its quite irritating having to make a new project.

      Maybe, but I would not recommend youdo it any other way. The project tool keeps your projects settings. Some projects need different settings than others.

      > and having unnecessary code and confusing comments.

      Then remove them, or start with an 'empty' project. VC++ adds some stuff by default if you us the project wizard, you are inder no oblicgation to use it. Make sure that you select "no precompiled headers" in VC++ and the stdafx file will be empty, and can be removed from the project safely.

      > because rarely if ever do I need to make
      > multiple headers/source-files.

      Perhaps you should. I generally have one source file per class.

      Clifford

       
    • cpns

      cpns - 2009-02-01

      > I DON'T want a visual interface.

      I am assuming that you mean that you don't want to use the visual designer, rather than you don't want a "visual Interface" which kind of implies that you don't want a GUI app.

      > I DON'T want multiple settings that have to be read up on to use.

      You mean you don't want to do the necessary work of reading documentation and would rather have someone spoon feed you? Sorry, but that just sounds like laziness.

      To be honest I know little about wxWidgets, but this looks like fundamental coding error to me and nothing specific to wxWidgets. Perhaps you need to learn C++ first, and specifically how to interpret compiler error messages.


      > hello.cpp:13: error: wxAppConsole' is an inaccessible base ofBasicApp'

      I suggest perhaps the problem is in line 3 which should probably be:

      class BasicApp : public wxApp

      A quick look at the documentation (in fact I just Googled wxApp) indicates I may be right: http://docs.wxwidgets.org/stable/wx_wxappoverview.html

      Note that it took less time to find that example than it took you two write your question, so perhaps your unwillingness to 'read up' is not really paying dividends is it?

      Clifford

       
    • Nick Chang

      Nick Chang - 2009-02-01

      Thanks Clifford, and I'm terribly sorry for sounding like an ass (or being one) in the opening post.

      Its just that my 'unwillingness to read up' comes from my increasing frustration of not being able to compile the simplest of programs, which, as I realize now, I shouldn't blame Bloodshed for.

      That said, 'public' fixed the problem, but I'm having another error, (runtime, I think, 'cause it seems to have compiled) but I'll try to fix it by myself for now.

       
    • cpns

      cpns - 2009-02-01

      In my opinion the only reason to use wxDev-C++ is because it has wxWidgets and a visual designer integrated. The plain vanilla Dev-C++ is no longer a good choice since there are better free IDE/Compiler packages available, whereas it was once unique in the field.

      If all you wanted was visual design, use VC++ Express and Windows Forms (even if that means learning a bit of C++/CLI - or just use C#). If all you wanted was wxWidgets, then use VC++ Express and a VC++ build of the wxWidgets library.

      What I am saying, is that wxWidgets plus the designer is the only thing that makes wxDev-C++ attractive and still useful. If you want one without the other, there are better tools.

      Note that wxDev-C++ unlike Dev-C++ can use VC++'s command line tools as an alternative back-end toolchain. I do not know whether doing that fixes Dev-C++'s main flaw - its atrocious debugger integration -I doubt it, but at least you then have the option to fire up VC++ Express to use its superior debugger, code navigation, and code editing tools, while perhaps just using wxDev-C++ as little more than a stand alone Visual Designer.

      Clifford

       
    • Nick Chang

      Nick Chang - 2009-02-01

      The thing is, I do want another compiler, but I don't know which one to choose. I guess I'll go for Code::Blocks, since it looked okay and all.

      Is wxWidgets integrated into VisualC++? I thought it used MFCs, so abandoned it.

      Thanks once again Clifford. And since we're already here, I was wondering if you knew any compilers that could compile a stand-alone source-file? Its quite irritating having to make a new project, and having unnecessary code and confusing comments. I had taken to using the older version of Dev-cpp just because it could compile a single source-file, because rarely if ever do I need to make multiple headers/source-files.

       
    • anonymous nobody

      >and having unnecessary code and confusing comments
      I don't see how having a project with one file requires unnecessary code or confusing comments.

      -JM

       
    • Nick Chang

      Nick Chang - 2009-02-02

      > I don't see how having a project with one file requires unnecessary code or confusing comments.

      It doesn't require unnecessary code, Dev inserts the code itself. Not only that, it opens multiple files (four, I think) with a load of multi-line comments that confuse me all the more. I don't require half of the pre-written code, which is, again, frustrating.

      Code::Blocks is definitely not the solution; it had a lebenty-jillion steps that took atleast 15 minutes to fill out.

      'Nuff said.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.