compiling with wxwidgets
-
- In need of some credit
- Posts: 7
- Joined: Thu Aug 10, 2017 6:06 pm
compiling with wxwidgets
I'm sorry for the newbie question. Under windows I have just downloaded the wxwidgets installer and I have installed the wxwidgets. Now I have to compile a project that works good on linux and I get the following error message:
wx/setup.h no such file or directory
I compile with `wx-config --cflags` and link with `wx-config --libs`
Have I to add some other paths for compiling with wxwidgets?
wx/setup.h no such file or directory
I compile with `wx-config --cflags` and link with `wx-config --libs`
Have I to add some other paths for compiling with wxwidgets?
Re: compiling with wxwidgets
Please check the build instructions in <wxdir>/docs/msw/install.txt
Use the source, Luke!
-
- In need of some credit
- Posts: 7
- Joined: Thu Aug 10, 2017 6:06 pm
Re: compiling with wxwidgets
I have downloaded wx-config to use the same project that I have under linux with the same compiler options. From the prompt when I type wx-config --cflags it gives me an error: No valid setup.h has been found at location c:\wxWidgets\lib\gcc_dll\msw\wx\setup.h
The folder gcc_dll doesn't exist. How can I solve the problem?
The folder gcc_dll doesn't exist. How can I solve the problem?
Re: compiling with wxwidgets
Have you actually built the wxWidgets libraries? If yes, with which options?
Use the source, Luke!
-
- In need of some credit
- Posts: 7
- Joined: Thu Aug 10, 2017 6:06 pm
Re: compiling with wxwidgets
I have installed wxWidgets using the windows installer for wxWidgets 3.0.3. Are there some other files that I have to install to compile a wxWidgets application with mingw?
Re: compiling with wxwidgets
The installer just installs the source files, you still have to build be libraries.winniepooh wrote:I have installed wxWidgets using the windows installer for wxWidgets 3.0.3. Are there some other files that I have to install to compile a wxWidgets application with mingw?
There are some precompiled binaries here:
https://github.com/wxWidgets/wxWidgets/ ... tag/v3.1.0
But i would suggest to build the libraries yourself as described in <wxdir>/docs/msw/install.txt
Successfully building the libs yourself ensures that your compiler toolchain works correctly and that the libs and your application fit together perfectly.
Use the source, Luke!
-
- In need of some credit
- Posts: 7
- Joined: Thu Aug 10, 2017 6:06 pm
Re: compiling with wxwidgets
Ok, now my application compiles but the linker gives this error:
Code: Select all
g++.exe -o bin\Debug\FM.exe obj\Debug\FMApp.o obj\Debug\FMMain.o obj\Debug\F1.o obj\Debug\F2.o -mthreads -LC:\wxWidgets\lib\gcc_dll -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -mwindows
obj\Debug\FMApp.o: In function `WinMain@16':
C:/Users/Fabio/Desktop/FM/FMApp.cpp:17: undefined reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'
obj\Debug\FMApp.o: In function `Z11wxCreateAppv':
C:/Users/Fabio/Desktop/FM/FMApp.cpp:17: undefined reference to `wxAppConsoleBase::CheckBuildOptions(char const*, char const*)'
obj\Debug\FMApp.o: In function `ZN10FMApp6OnInitEv':
C:/Users/Fabio/Desktop/FM/FMApp.cpp:23: undefined reference to `wxInitAllImageHandlers()'
C:/Users/Fabio/Desktop/FM/FMApp.cpp:28: undefined reference to `wxDialog::ShowModal()'
obj\Debug\FMApp.o: In function `ZN23wxCriticalSectionLockerC1ER17wxCriticalSection':
C:/wxWidgets/include/wx/thread.h:307: undefined reference to `wxCriticalSection::Enter()'
obj\Debug\FMApp.o: In function `ZN23wxCriticalSectionLockerD1Ev':
C:/wxWidgets/include/wx/thread.h:312: undefined reference to `wxCriticalSection::Leave()'
obj\Debug\FMApp.o: In function `ZN12wxEvtHandler9TryParentER7wxEvent':
C:/wxWidgets/include/wx/event.h:3685: undefined reference to `wxEvtHandler::DoTryApp(wxEvent&)'
obj\Debug\FMApp.o: In function `ZN16wxAppConsoleBase22SetInitializerFunctionEPFP12wxAppConsolevE':
C:/wxWidgets/include/wx/app.h:431: undefined reference to `wxAppConsoleBase::ms_appInitFn'
obj\Debug\FMApp.o: In function `ZN16wxAppConsoleBase11GetInstanceEv':
C:/wxWidgets/include/wx/app.h:439: undefined reference to `wxAppConsoleBase::ms_appInstance'
obj\Debug\FMApp.o: In function `ZN10FMAppC1Ev':
C:/Users/Fabio/Desktop/FM/FMApp.h:15: undefined reference to `wxApp::wxApp()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x8): undefined reference to `wxApp::GetClassInfo() const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x14): undefined reference to `wxObject::CreateRefData() const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x18): undefined reference to `wxObject::CloneRefData(wxRefCounter const*) const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x24): undefined reference to `wxEvtHandler::ProcessEvent(wxEvent&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x28): undefined reference to `wxEvtHandler::QueueEvent(wxEvent*)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x30): undefined reference to `wxEvtHandler::SearchEventTable(wxEventTable&, wxEvent&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x34): undefined reference to `wxEvtHandler::TryBefore(wxEvent&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x38): undefined reference to `wxEvtHandler::TryAfter(wxEvent&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x44): undefined reference to `wxApp::GetEventTable() const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x48): undefined reference to `wxApp::GetEventHashTable() const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x4c): undefined reference to `wxEvtHandler::DoSetClientObject(wxClientData*)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x50): undefined reference to `wxEvtHandler::DoGetClientObject() const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x54): undefined reference to `wxEvtHandler::DoSetClientData(void*)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x58): undefined reference to `wxEvtHandler::DoGetClientData() const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x5c): undefined reference to `wxApp::Initialize(int&, wchar_t**)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x68): undefined reference to `wxAppBase::OnRun()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x6c): undefined reference to `wxAppConsoleBase::OnLaunched()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x74): undefined reference to `wxAppBase::OnExit()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x7c): undefined reference to `wxApp::CleanUp()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x84): undefined reference to `wxAppConsoleBase::Exit()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x88): undefined reference to `wxAppBase::OnInitCmdLine(wxCmdLineParser&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x8c): undefined reference to `wxAppBase::OnCmdLineParsed(wxCmdLineParser&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x90): undefined reference to `wxAppConsoleBase::OnCmdLineHelp(wxCmdLineParser&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x94): undefined reference to `wxAppConsoleBase::OnCmdLineError(wxCmdLineParser&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x98): undefined reference to `wxAppConsoleBase::SetCLocale()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0x9c): undefined reference to `wxAppConsoleBase::FilterEvent(wxEvent&)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xa0): undefined reference to `wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xa4): undefined reference to `wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xa8): undefined reference to `wxAppConsoleBase::OnUnhandledException()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xac): undefined reference to `wxApp::OnExceptionInMainLoop()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xb0): undefined reference to `wxAppConsoleBase::ProcessPendingEvents()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xb4): undefined reference to `wxAppConsoleBase::Pending()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xb8): undefined reference to `wxAppConsoleBase::Dispatch()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xbc): undefined reference to `wxAppConsoleBase::MainLoop()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xc0): undefined reference to `wxAppConsoleBase::ExitMainLoop()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xc4): undefined reference to `wxApp::WakeUpIdle()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xc8): undefined reference to `wxAppBase::ProcessIdle()'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xd0): undefined reference to `wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xd4): undefined reference to `wxAppConsoleBase::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*)'
obj\Debug\FMApp.o:FMApp.cpp:(.rdata$_ZTV10FMApp[__ZTV10FMApp]+0xd8): undefined reference to `wxAppBase::CreateTraits()'
Re: compiling with wxwidgets
i dont see wx_base in your linker command
-
- In need of some credit
- Posts: 7
- Joined: Thu Aug 10, 2017 6:06 pm
Re: compiling with wxwidgets
I have used wx-config so there is a problem with the configuration. Despite this I have added by hand to the linker -lwxbase30u.
It gives another error:
It gives another error:
Code: Select all
g++.exe -o bin\Release\FM.exe obj\Release\FMApp.o obj\Release\FMMain.o obj\Release\F1.o obj\Release\F2.o -s -mthreads -LC:\wxWidgets\lib\gcc_dll -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwxbase30u -mwindows
obj\Release\FMApp.o:FMApp.cpp:(.text+0x6b): undefined reference to `wxApp::wxApp()'
obj\Release\FMApp.o:FMApp.cpp:(.text+0xea): undefined reference to `wxEntry(HINSTANCE__*, HINSTANCE__*, char*, int)'
obj\Release\FMApp.o:FMApp.cpp:(.text+0x10e): undefined reference to `wxApp::~wxApp()'
obj\Release\FMApp.o:FMApp.cpp:(.text+0x1bf): undefined reference to `wxInitAllImageHandlers()'
obj\Release\FMApp.o:FMApp.cpp:(.text+0x1f6): undefined reference to `wxDialog::ShowModal()'
Re: compiling with wxwidgets
Hi,
How did you uild the library and how do you building the application?
Which compiler exactly do you use (version/flavor/where to download)?
Thank you.
How did you uild the library and how do you building the application?
Which compiler exactly do you use (version/flavor/where to download)?
Thank you.
-
- In need of some credit
- Posts: 7
- Joined: Thu Aug 10, 2017 6:06 pm
Re: compiling with wxwidgets
I have downloaded the windows installer. Installed the package and then I have gone under c:\wxWidgets\build\msw and run
mingw32-make -f makefile.gcc BUILD=release SHARED=1
I have used the mingw compiler that comes with codeblocks if i'm not wrong is the one in this link https://sourceforge.net/projects/codebl ... -setup.exe
is the gcc version 4.9.2 (tdm-1)
The options sent to the compiler (got with wx-config --cflags) when I build my application are:
The option sent to the linker (got with wx-config --libs) are:
I have added -lwxbase30u by hand because wx-config didn't include it
mingw32-make -f makefile.gcc BUILD=release SHARED=1
I have used the mingw compiler that comes with codeblocks if i'm not wrong is the one in this link https://sourceforge.net/projects/codebl ... -setup.exe
is the gcc version 4.9.2 (tdm-1)
The options sent to the compiler (got with wx-config --cflags) when I build my application are:
Code: Select all
g++.exe -fomit-frame-pointer -fexpensive-optimizations -Os -Wextra -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets\lib\gcc_dll\mswu -IC:\wxWidgets\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -Wl,--subsystem,windows -mwindows -Wl,--enable-auto-import -c C:\Users\Fabio\Desktop\FM\FMApp.cpp -o obj\Release\FMApp.o
Code: Select all
g++.exe -o bin\Release\FM.exe obj\Release\FMApp.o obj\Release\FMMain.o obj\Release\F1.o obj\Release\F2.o -s -mthreads -LC:\wxWidgets\lib\gcc_dll -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwxbase30u -mwindows
Re: compiling with wxwidgets
Hi,
Don't use wx-config to build the application. This script is designed solely for the purpose of building on *nix/Cygwin with configure script.
Instead, go to the wxWidgets/samples/minimal and do "make". Look at what make generates in order to build the minimal sample.
Copy its output to some batch file adjusting the folders path and run it.
Alternatively, create a project inside the C:B, making sure that the projects options are "Release" build with "Shared" libraries, add the source code, build and run.
Thank you.
Let us know if you encounter any issues.
Don't use wx-config to build the application. This script is designed solely for the purpose of building on *nix/Cygwin with configure script.
Instead, go to the wxWidgets/samples/minimal and do "make". Look at what make generates in order to build the minimal sample.
Copy its output to some batch file adjusting the folders path and run it.
Alternatively, create a project inside the C:B, making sure that the projects options are "Release" build with "Shared" libraries, add the source code, build and run.
Thank you.
Let us know if you encounter any issues.
Re: compiling with wxwidgets
Code: Select all
C:/Users/Fabio/Desktop/FM/FMApp.cpp:17: undefined reference to `wxAppConsoleBase::CheckBuildOptions(char const*, char const*)'
Also, the "core" lib is missing, too.
Use the source, Luke!
-
- In need of some credit
- Posts: 7
- Joined: Thu Aug 10, 2017 6:06 pm
Re: compiling with wxwidgets
Thank you so much to everybody. Finally I have solved and now wxwidgets works very well also under windows.
I rebuild the library and use the options of the sample makefile.
I rebuild the library and use the options of the sample makefile.