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.
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

Postby JeffBrandl » Mon Mar 20, 2017 5:50 pm

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: 11295
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Postby doublemax » Mon Mar 20, 2017 7:49 pm

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

Postby JeffBrandl » Tue Mar 21, 2017 10:38 am

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
wxWorld Domination!
wxWorld Domination!
Posts: 1276
Joined: Sun Jan 03, 2010 5:45 pm

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

Postby PB » Tue Mar 21, 2017 11:17 am

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

Postby JeffBrandl » Tue Mar 21, 2017 5:40 pm

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
wxWorld Domination!
wxWorld Domination!
Posts: 1276
Joined: Sun Jan 03, 2010 5:45 pm

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

Postby PB » Tue Mar 21, 2017 7:59 pm

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
I live to help wx-kind
I live to help wx-kind
Posts: 176
Joined: Fri Nov 03, 2006 2:00 pm

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

Postby stahta01 » Tue Mar 21, 2017 9:59 pm

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
wxWorld Domination!
wxWorld Domination!
Posts: 1276
Joined: Sun Jan 03, 2010 5:45 pm

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

Postby PB » Wed Mar 22, 2017 6:32 am

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: 1931
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

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

Postby ONEEYEMAN » Wed Mar 22, 2017 1:26 pm

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

Postby JeffBrandl » Wed Mar 22, 2017 5:09 pm

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.


Return to “Compiler / Linking / IDE Related”

Who is online

Users browsing this forum: No registered users and 6 guests