problem building and running wxWidget
Posted: Mon Feb 08, 2021 3:03 am
Hello
I have this app in main.cpp
Code: Select all
// wxWidgets "Hello world" Program
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
class MyApp: public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
private:
void OnHello(wxCommandEvent& event);
void OnExit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
wxDECLARE_EVENT_TABLE();
};
enum
{
ID_Hello = 1
};
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Hello, MyFrame::OnHello)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
wxEND_EVENT_TABLE()
wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50, 50), wxSize(450, 340) );
frame->Show( true );
return true;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(NULL, wxID_ANY, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
"Help string shown in status bar for this menu item");
menuFile->AppendSeparator();
menuFile->Append(wxID_EXIT);
wxMenu *menuHelp = new wxMenu;
menuHelp->Append(wxID_ABOUT);
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, "&File" );
menuBar->Append( menuHelp, "&Help" );
SetMenuBar( menuBar );
CreateStatusBar();
SetStatusText( "Welcome to wxWidgets!" );
}
void MyFrame::OnExit(wxCommandEvent& event)
{
Close( true );
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxMessageBox( "This is a wxWidgets' Hello world sample",
"About Hello World", wxOK | wxICON_INFORMATION );
}
void MyFrame::OnHello(wxCommandEvent& event)
{
wxLogMessage("Hello world from wxWidgets!");
}
Build log gives:
Code: Select all
C:\WINDOWS\system32\cmd.exe /C C:/Min-gw/mingw64/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ TryWorkspace - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/f-alm/Desktop/Eman/TryWorkspace/TryWorkspace'
C:/Min-gw/mingw64/bin/g++.exe -c "C:/Users/f-alm/Desktop/Eman/TryWorkspace/TryWorkspace/main.cpp" -g -O0 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:/wxWidgets-3.1.4/lib/gcc_dll/mswud -IC:/wxWidgets-3.1.4/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -o ../build-Debug/TryWorkspace/main.cpp.o -I.
C:/Min-gw/mingw64/bin/g++.exe -o ..\build-Debug\bin\TryWorkspace @../build-Debug/TryWorkspace/ObjectsList.txt -L. -mwindows -mthreads -LC:/wxWidgets-3.1.4/lib/gcc_dll -lwxmsw31ud_richtext -lwxmsw31ud_xrc -lwxmsw31ud_aui -lwxmsw31ud_html -lwxmsw31ud_adv -lwxmsw31ud_core -lwxbase31ud_xml -lwxbase31ud_net -lwxbase31ud -lwxscintillad -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lversion -lshlwapi -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -luxtheme -loleacc
mingw32-make.exe[1]: Leaving directory 'C:/Users/f-alm/Desktop/Eman/TryWorkspace/TryWorkspace'
====0 errors, 0 warnings====
However, There is red arrow beside #include <wx/wx.h>
when i hover next to it a message apperas:
in included file: definition of builtin function '__rdtsc' C:\Min-gw\mingw64\lib\gcc\x86_64-w64-mingw32\8.1.0\include\ia32intrin.h:112:1:note: error occurred here
When I run this file:
a window flash quickly and closed
This is output log:
Code: Select all
Working directory is set to: C:\Users\f-alm\Desktop\Eman\TryWorkspace\build-Debug\lib
Executing: cmd /C C:\Users\f-alm\Desktop\Eman\TryWorkspace\build-Debug\bin\TryWorkspace.exe
Program exited
Any help is appreciated