Eclipse, CDT, MinGW, missing wx-config

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
JeffBrandl
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Mar 20, 2017 5:26 pm

Eclipse, CDT, MinGW, missing wx-config

Post by JeffBrandl »

Hi,
I'm trying to use wxWidget for my C++ code on Windows. I'm using Eclipse + CDT, and they works. I've installed wxWidget (3.1.0) and then compiled it with mingw32-make as written in https://wiki.wxwidgets.org/Compiling_wx ... with_MinGW. Then I've set Project settings to include the following directories (Project Settings, Path and Symbolds, Include) : C:\wxWidgetxx\lib\gcc_dll, C:\wxWidgetxx\include, C:\wxWidgetxx\lib\gcc-dll\mswu (where the linker should find setup.h)
I tried to build an Hello World example and it still reports error on class MyApp: public wxApp (undefined reference to 'wxApp::~wxApp()'). So I found that i forgot to set the compiler flags g++ 'wx-config --static=no --cxflags' and linker flags: -mwindows 'wx-config --static=no --libs'
However, wx-config seems not available in my computer.

Info: Internal Builder is used for build
g++ -o minimal borland_ide.o minimal.o -mwindows `wx-config --static=no --libs`
g++: error: `wx-config: No such file or directory
g++: error: unrecognized command line option '--static=no'
g++: error: unrecognized command line option '--libs`'

If i call it from cmd.exe it is not a reconnized command. I thought it was available with wxWidget. Am I wrong? Or It is simply a matter of environmental variables? How can I fix this problem? The same happens with the "minimal" sample. Thanks
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Eclipse, CDT, MinGW, missing wx-config

Post by doublemax »

wx-config is only available under Linux or in a Unix-like environment, so under Windows you'll also need to install MSYS.

Alternatively you could set the paths etc. yourself.
Use the source, Luke!
JeffBrandl
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Mar 20, 2017 5:26 pm

Re: Eclipse, CDT, MinGW, missing wx-config

Post by JeffBrandl »

Thank you doublemax for your reply. Unfortunately now i'm not sure of what configuration i'm missing.. I included the "include" directory and "lib/gcc_dll/mswu" keeping the second one on top (i removed "lib/gcc_dll" because i thought it wasn't really needed) and i don't get any erorr about setup.h. But why i still miss wxApp? What are the path you're talking about?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Eclipse, CDT, MinGW, missing wx-config

Post by PB »

Sorry for the stupid question, but: Have you followed the official documentation provided in wxwin\docs\msw\install.txt, particularly the Building Applications Using wxWidgets part?

I have never used Eclipse, but I believe those instructions apply to pretty much any IDE with C++ support - I followed them successfully for MS Visual Studio, Code::Blocks, CodeLite, and NetBeans in the past.
JeffBrandl
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Mar 20, 2017 5:26 pm

Re: Eclipse, CDT, MinGW, missing wx-config

Post by JeffBrandl »

It's not a stupid question, actually I have a stupid answer. No because I trusted the wxWiki documentation. However, I thought it could be a wrong installation so I removed MinGW and reinstall it before following the building procedure reported on wxwin\docs\msw\install.txt
But now i can't even build the libraries (Both with MSYS and mingw32-make). Looking for the question in this forum I found that maybe some error could come from MinGW installation so i removed it again and installed TDM-GCC but I get some compatibility error building the wxwidgets ('gcc_mswuddll\basedll_version_rc.o is incompatible with i386:x86-64 output')
Now I'm trying to reinstall TDM-GCC only for 32 bit.

For what concern the part on Building Applications, maybe I should tried it before uninstall wxwidget.. because i found some path that i haven't set.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Eclipse, CDT, MinGW, missing wx-config

Post by PB »

FWIW, this is a batch file I use to build 32-bit wxWidgets on 32-bit MSW with TDM-GCC-64 :

Code: Select all

PATH=%PATH%;C:\TDM-GCC-64\bin

cd %WXWIN%\build\MSW

REM static debug
mingw32-make -f makefile.gcc CPP="gcc -E -D_M_IX86 -m32" CFLAGS="-m32" CXXFLAGS="std=gnu++11 -m32" CPPFLAGS="-m32" LDFLAGS="-m32" WINDRES="windres --use-temp-file -F pe-i386" BUILD=debug

REM static release
mingw32-make -f makefile.gcc CPP="gcc -E -D_M_IX86 -m32" CFLAGS="-m32" CXXFLAGS="std=gnu++11 -m32" CPPFLAGS="-m32" LDFLAGS="-m32" WINDRES="windres --use-temp-file -F pe-i386" BUILD=release

REM multilib shared debug
mingw32-make -f makefile.gcc SHARED=1 CPP="gcc -E -D_M_IX86 -m32" CFLAGS="-m32" CXXFLAGS="std=gnu++11 -m32" CPPFLAGS="-m32" LDFLAGS="-m32" RCFLAGS="-F pe-i386" WINDRES="windres --use-temp-file -F pe-i386" BUILD=debug

REM multilib shared release
mingw32-make -f makefile.gcc SHARED=1 CPP="gcc -E -D_M_IX86 -m32" CFLAGS="-m32" CXXFLAGS="std=gnu++11 -m32" CPPFLAGS="-m32" LDFLAGS="-m32" RCFLAGS="-F pe-i386" WINDRES="windres --use-temp-file -F pe-i386" BUILD=release
BTW, you can significantly speed-up the building process if you have a multicore CPU and tell GCC to use more than one core, e.g.

Code: Select all

REM static debug, use 2 cores, needs building setup_h target first
mingw32-make  -j2 -f makefile.gcc CPP="gcc -E -D_M_IX86 -m32" CFLAGS="-m32" CXXFLAGS="std=gnu++11 -m32" CPPFLAGS="-m32" LDFLAGS="-m32" WINDRES="windres --use-temp-file -F pe-i386" BUILD=debug setup_h
mingw32-make  -j2 -f makefile.gcc CPP="gcc -E -D_M_IX86 -m32" CFLAGS="-m32" CXXFLAGS="std=gnu++11 -m32" CPPFLAGS="-m32" LDFLAGS="-m32" WINDRES="windres --use-temp-file -F pe-i386" BUILD=debug
As always, make sure you don't have more than one GCC-based toolchain in the path and there are no remains of the previous build (I just delete all folders starting with "gcc_" both in WXWIN\build\msw and WXWIN\lib).

BTW, when asking about an issue with building wxWigets, you are expected to post the exact command line you used, provide the relevant part of the build output and list your wxWidgets version and compiler information.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Eclipse, CDT, MinGW, missing wx-config

Post by stahta01 »

Instead of

Code: Select all

PATH=%PATH%;C:\TDM-GCC-64\bin
I strongly suggest you do this instead.

Code: Select all

PATH=C:\TDM-GCC-64\bin;%PATH%
Tim S.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Eclipse, CDT, MinGW, missing wx-config

Post by PB »

Stahta01, I'm just curious: Why do you strongly suggest that, i.e., why does the order matter. I obviously assume there is no other GCC-based toolchain in the path, as people who allow adding compiler tools to the path probably have added TDM-GCC there too.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Eclipse, CDT, MinGW, missing wx-config

Post by ONEEYEMAN »

PB,
Nobody prevents people from installing different compiler on the same machine.
So if they have multiple compilers making the one that they use first one in the path will run this compiler.

Thank you.
JeffBrandl
In need of some credit
In need of some credit
Posts: 4
Joined: Mon Mar 20, 2017 5:26 pm

Re: Eclipse, CDT, MinGW, missing wx-config

Post by JeffBrandl »

Hi,
I finally succeed. Here is the procedure I followed:
1) installed a MinGW stable version (all packages) by means of TDM-GCC 32 bit (maybe the one from mingw would work anyway)
2) build wxWidget (both debug and release) with the following commands

mingw32-make -f makefile.gcc SHARED=1 BUILD=debug
mingw32-make -f makefile.gcc SHARED=1 BUILD=release

3) following the wxwin\docs\msw\install.txt i set the project configuration as follow:
Project -> Properties -> C/C++ General -> Path and Symbols
3a) Includes: add the C:\wxWidgetxxxx\lib\gcc_dll\mswu and C:\wxWidgetxxxx\include directories (Note: for debug configuration set the mswud instead of mswu)
3b) Symbols: add _WINDOWS, __WXMSW__, _DEBUG, __WXDEBUG__ for debug configuration whereas add __WXMSW__, _WINDOWS, NDEBUG for release configuration
3c) Libraries: add wxmsw31u_core, wxbase31u, wxbase31u_net, wxbase31u_xml, wxexpat, wxjpeg (substitude u with ud for debug configuration) (maybe only some of them are really needed, i currently don't know)
3d) Library path: add C:\wxWidgetxxxx\lib\gcc_dll

Now eclipse is able to build the hello world example on the wxWidget website.
After the executable has been obtained, add in the same directory the following dlls: libgcc_s_dw2-1.dll, libstdc++-6.dll, wxbase310u_gcc_custom.dll, wxmsw310u_core_gcc_custom.dll (you must run the executable as administrator to see the real dependencies, as normal user the first 2 dlls won't be asked for)

Now the Hello World run. I know it is not the minimal or best way of doing but it is the first configuration which works.
Thanks for all your precious help and sorry if my posts were not so clear.
Post Reply