#include <wx/wx.h>

class Hello : public wxApp
{
    public:
        virtual bool OnInit();
};

IMPLEMENT_APP(Hello)

bool Hello::OnInit()
{
    wxFrame *frame = new wxFrame(NULL, -1, _T("Hello"), wxPoint(60, 70), wxSize(500, 600));

    frame -> show(true);

    SetTopWindow(frame);

    return true;
}

C:\Documents and Settings\Levi\Desktop\C+++\Makefile.win [Build Error] exe: *** [Output/MingW/Project1.exe] Error 1

Why do i get this error when i try to compile a simple wxFrame app in wxDev-cpp

thanks

Edit:


Well, im an idiot, i didnt have my source file saved lol. But the new question is, my compiler says show is not a member of wxFrame, so how am i supposed to show the actual window?

Dani AI

Generated

Two separate, common issues were at play here. The original build error turned out to be an unsaved source file, and then the compiler complaint about "show is not a member" was simply a case-sensitivity problem — C++ distinguishes Show from show. spotted the capitalization; confirmed that fixing that (and saving the file) resolved the problem.

A few practical tips to avoid the same confusion later:

  • Save files before building. Many IDEs have a "build only saved files" option; enabling it avoids mysterious build errors when you forget to save.
  • Remember C++ is case-sensitive. If the compiler says a member is missing, check spelling and case first.
  • Verify the object type. If the symbol still isn't found, make sure the variable really is a wxFrame (or a class derived from it) and that you included the correct headers. Name collisions or a different type can produce the same error message.
  • Use wxID_ANY instead of -1 for default IDs, and call the frame-showing routine (capitalization matters) before returning true from OnInit. SetTopWindow is optional but fine to keep.

If errors persist after those checks: clean the project and rebuild, double-check include and linker settings for your wxWidgets installation, and enable compiler diagnostics to see the exact declaration the compiler is expecting. Small typos and unsaved buffers are surprisingly common culprits when a simple GUI sample refuses to compile.

Recommended Answers

All 2 Replies

Member Avatar for Member #248612
frame -> [U]S[/U]how(true);

o wow, thank you that worked

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.