i can compile c++ file using visual studio, but i wanna compile it using Mingw(gcc / g++).
Note: i don’t know much about wxWidgets
when i run gcc main.cpp -I C:wxWidgets-3.2.5includemsvc -I C:wxWidgets-3.2.5include -L C:wxWidgets-3.2.5libvc_x64_lib -mwindows
it gives me this error message
In file included from C:wxWidgets-3.2.5include/wx/platform.h:159:0, from C:wxWidgets-3.2.5include/wx/defs.h:45, from C:wxWidgets-3.2.5include/wx/wx.h:14, from main.cpp:1: C:wxWidgets-3.2.5includemsvc/wx/setup.h:12:6: error: #error "This file should only be included when using Microsoft Visual C++" #error "This file should only be included when using Microsoft Visual C++" ^~~~~ In file included from C:wxWidgets-3.2.5include/wx/platform.h:159:0, from C:wxWidgets-3.2.5include/wx/defs.h:45, from C:wxWidgets-3.2.5include/wx/wx.h:14, from main.cpp:1: C:wxWidgets-3.2.5includemsvc/wx/setup.h:142:27: fatal error: ../../../lib/vc_lib/msw/wx/setup.h: No such file or directory #include wxSETUPH_PATH_STR ^ compilation terminated.
but i don’t want to use Microsoft Visual studio. i prefer to compile it using Mingw(g++ / gcc) or from a makefile
the code i tried to compile, it’s a simple hello world program that i got from internet.
it works perfectly with Microsoft Visual studio when i tried to compile.
#include <wx/wx.h>
class App : public wxApp {
public:
bool OnInit() {
wxFrame* window = new wxFrame(NULL, wxID_ANY, "GUI Test", wxDefaultPosition, wxSize(600, 400));
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* text = new wxStaticText(window, wxID_ANY, "Well Done!nEverything seems to be working",
wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
text->SetFont(wxFont(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
sizer->Add(text, 1, wxALIGN_CENTER);
window->SetSizer(sizer);
window->Show();
return true;
}
};
wxIMPLEMENT_APP(App);
udaan jayanith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.