WxWidgets with Mingw wx/msw/libraries.h: not found

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Maykon
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Sep 21, 2022 5:31 pm

WxWidgets with Mingw wx/msw/libraries.h: not found

Post by Maykon »

I'm using Debian 11, I installed Mingw and built WxWidgets with the following command:

Code: Select all

../configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-ming32 --build=x86_64-linux --with-msw && make && sudo make install
wx.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();
private:
    void OnHello(wxCommandEvent& event);
    void OnExit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);
};

enum{
    ID_Hello = 1
};

wxIMPLEMENT_APP(MyApp);

bool MyApp::OnInit(){
    MyFrame *frame = new MyFrame();
    frame->Show(true);
    return true;
}

MyFrame::MyFrame() : wxFrame(NULL, wxID_ANY, "Hello World"){
    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("Bem-vindo ao Terminal Root!");
    Bind(wxEVT_MENU, &MyFrame::OnHello, this, ID_Hello);
    Bind(wxEVT_MENU, &MyFrame::OnAbout, this, wxID_ABOUT);
    Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
}

void MyFrame::OnExit(wxCommandEvent& event){
    Close(true);
}

void MyFrame::OnAbout(wxCommandEvent& event){
    wxMessageBox("Test",
                 "Testt", wxOK | wxICON_INFORMATION);
}

void MyFrame::OnHello(wxCommandEvent& event){
    wxLogMessage("Test");
}
And I'm using the following command to build:

Code: Select all

x86_64-w64-mingw32-g++ wx.cpp `wx-config --cxxflags --libs std,aui`
I receive the following error:

/usr/local/include/wx-3.2/wx/platform.h:322:13: fatal error: wx/msw/libraries.h: file not found:
#include "wx/msw/libraries.h"

But file exists.

Where am I going wrong?

PS: I don't use any kind of IDE.
Last edited by Maykon on Wed Sep 21, 2022 5:47 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 17605
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by doublemax »

So you want to cross-compile for Windows under Linux?

What's the output of this command?

Code: Select all

wx-config --cxxflags --libs std,aui
Use the source, Luke!
Maykon
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Sep 21, 2022 5:31 pm

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by Maykon »

That, I'm on Linux (Debian) building for Windows.

Code: Select all

 
 wx-config --cxxflags --libs std,aui
-I/usr/local/lib/wx/include/gtk3-unicode-3.2 -I/usr/local/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
-L/usr/local/lib -pthread   -lwx_gtk3u_aui-3.2 -lwx_gtk3u_xrc-3.2 -lwx_gtk3u_html-3.2 -lwx_gtk3u_qa-3.2 -lwx_gtk3u_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 
On linux it works with:

Code: Select all

g++ wx.cpp `wx-config --cxxflags --libs std,aui`
Last edited by Maykon on Wed Sep 21, 2022 5:57 pm, edited 2 times in total.
User avatar
doublemax
Moderator
Moderator
Posts: 17605
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by doublemax »

The output of wx-config seems to be from the previously installed GTK version, not for MSW.

Check if there's another instance of wx-config inside the path you used as prefix.

(Sorry, i don't work under Linux, so i'm just guessing based on things i've read here in the past).
Use the source, Luke!
Maykon
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Sep 21, 2022 5:31 pm

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by Maykon »

This is actually a clean install of Debian, I did this install just to test this.
I've been trying to do this build for over a week now.
User avatar
doublemax
Moderator
Moderator
Posts: 17605
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by doublemax »

Maykon wrote: Wed Sep 21, 2022 6:29 pm This is actually a clean install of Debian, I did this install just to test this.
Most Linux distros come with wxWidgets pre-installed.
Check if there's another instance of wx-config inside the path you used as prefix.
Did you do this?
Use the source, Luke!
Maykon
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Sep 21, 2022 5:31 pm

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by Maykon »

I look, and there is no other installed
User avatar
doublemax
Moderator
Moderator
Posts: 17605
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by doublemax »

Maykon wrote: Wed Sep 21, 2022 11:47 pm I look, and there is no other installed
That's strange. The wxWiki says:
Whenever you build wxWidgets, a local wx-config will be created in the build directory. You can then simply get the flags by calling wx-config locally : ./wx-config. This can also help keeping different configurations truly separate and may avoid some conflicts.
https://wiki.wxwidgets.org/Wx-Config
Use the source, Luke!
Maykon
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Sep 21, 2022 5:31 pm

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by Maykon »

I'll try to reinstall linux to see if it solves the problem, it could be something I did wrong.
I'll let you know later, thanks
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 6222
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by ONEEYEMAN »

Hi,
BTW, you don't have to install the library (run "make install") you can just run /wxWidgets/build/directory/wx-config --cxxflags --libs.

Thank you.

P.S.: What is the output of:

Code: Select all

which wx-config
Thank you.
Maykon
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Sep 21, 2022 5:31 pm

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by Maykon »

Sorry for the delay, I tried to redo everything here but the same error.
The command which wx-config return :
/usr/bin/wx-config
User avatar
doublemax
Moderator
Moderator
Posts: 17605
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by doublemax »

It sounds like your version doesn't get built or installed correctly.

Code: Select all

../configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-ming32 --build=x86_64-linux --with-msw && make && sudo make install
Can you split this into three separate commands and check if there are any errors? And maybe show the result of the configure call?
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 3598
Joined: Sun Jan 03, 2010 5:45 pm

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by PB »

And did you try, as advised, to not install and use the local wxWidgets build with its wx-config?

When you run the local wx-config --libs, does it output the correct, i.e., MSW and not GTK libraries (and are the libraries actually there)?

I am not using Linux but it makes little sense to me to install libraries built for the Windows platform there...
Maykon
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Sep 21, 2022 5:31 pm

Re: WxWidgets with Mingw wx/msw/libraries.h: not found

Post by Maykon »

Friends, it finally worked, that's what you said above, the wx-config that is linked to the terminal, is only for linux, what was with the compilation for Windows inside /usr/x86_64-w64-mingw32/bin /wx-config.

When I want to compile for linux I pass:
g++ wx.cpp `wx-config --cxxflags --libs std,aui`

When I go to Windows I pass:
x86_64-w64-mingw32-g++ wx.cpp `/usr/x86_64-w64-mingw32/bin/wx-config --cxxflags --libs std,aui`

PS: I had to copy some dlls to the application folder, but it all worked out.

Thank you very much for everyone's patience.
Post Reply