Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ermano on April 04, 2014, 03:13:21 pm

Title: Getting a basic wxSmith/wxWidgets to compile/link
Post by: ermano on April 04, 2014, 03:13:21 pm
Good afternoon,

there is a problem that bugs me now for several days already and I just don't know how to solve it:

After some hiccups I can compile wxWidgets3.0.0 using the latest TDM-GCC (tdm64-gcc-4.8.1-3.exe) without any problems using the syntax:

mingw32-make -j4 -f  makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release TARGET_CPU=X64  2>_Error.log (same with "debug").
After compilation I get (in C:\wxWidgets-3.0.0\lib\gcc_dll) the  libwxmsw30u.a and  libwxmsw30ud.a for the release and the debug version respectively.

When starting C::B  13.12 I use:
Favourite Gui Builder: wxSmith -> Frame Based
wxWidgets Location: C:\wxWidgets-3.0.0
GNU GCC Compiler, "Create Debug" and "Create Release" are both ticked
"Use wxWidgets DLL", "wxWidgets is build as a monolithic library" and "Enable unicode" -> all ticked
"Create and use precompiled header (PCH)  is also ticked

In the C::B toolchain the C++ compiler is: x86_64-w64-mingw32-g++.exe (same for linker for dynamic libs) and ar.exe the one for static libs.

After creation of the new project with the above selections I immediately try to compile the "Hello World" equivalent of wxSmith.
In the past (using prior versions of C::B and wxWidgets) this went through without problems.
Now, however I get through the compilation process ok but the linker tells me: "ld.exe cannot find -lwxmsw30ud". (in Debug)
This is no surprise because there is no "lwxmsw30ud". The wxWidgets compilation yielded "libwxmsw30ud.a" so with a "lib"
in front of lwxmsw30ud.
Simple cheating tricks like changing libwxmsw30ud to lwxmsw30ud did not solve the problem either.

In the "Global compiler settings" -> Search Directories -> Compiler (Linker) I gave: "C:\wxWidgets-3.0.0\lib\gcc_dll"
The Global variable Base is also set to the correct path.

In the "Project Build options" -> Linker Settings I have the correct library name specified libwxmsw30u/d respectively for release/debug)

I have no clue why C::B always defaults to "lwxmsw30ud". There is also no trace of "lwxmsw30ud" in the Projects "cbp" -file
I somehow suspect that this is a matter of a 32/64 bit conflict without really knowing how to resolve this.
Nevertheless in an other attempt I also erased my wxWidgets directory completely and recompiled it omitting the   
"TARGET_CPU=X64" option in the wxWidgets compilation. The result was however the same.
My system is Windows Professional 7.

Any help would be greatly appreciated:  Hermann



Title: Re: Getting a basic wxSmith/wxWidgets program to compile/link
Post by: ermano on April 08, 2014, 10:14:44 am
Good morning,

since there was no way to get it to run I completely de-installed everything (wxWidgets and CB) and subsequently erased the
containing folders.
For the re-installation I used the gcc compiler that comes with CB 13.12 which I also used to
recompile wxWidgets with the standard settings (after a "clean"):
"mingw32-make -j4 -f  makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release   2>_Error.log " (same for "debug")

I can compile a basic and unaltered wxSmith program now (wizard settings as above), but when I start it, it crashes immediately.

The debugger message is also not very inspiring:

[debug][New Thread 1616.0x990]
[debug]Program received signal SIGSEGV, Segmentation fault.
[debug]0x00b25d96 in wxEventHashTable::wxEventHashTable (this=0x47916c <_fu30___ZN7wxFrame13sm_eventTableE>, table=...) at ../../src/common/event.cpp:915
[debug]C:\wxWidgets-3.0.0\src\common\event.cpp:915:30003:beg:0xb25d96
[debug]>>>>>>cb_gdb:

Would anybody know how to solve this issue ?

Last not least, there is another thing I do not understand. Upon de-installing CB completely (+ erasing the CB folder)
and re-installing it again it still remembers all the settings that there were before. When I launch CB all the history
of projects is still there as well as the (old) compiler (and other) settings.
What do I have to do, to do a full "clean-up" in order to re-start from scratch  ?

Thanks for your help!

Regards:  Hermann   
Title: Re: Getting a basic wxSmith/wxWidgets to compile/link
Post by: BlueHazzard on April 08, 2014, 11:40:22 am
The configuration file is stored somewhere in your user folder: User/App Data/Roaming/CodeBlocks. Delete this folder and (at least i think) all settings will get lost.

about the segfault: Are you using the hello world program from wxSmith? Can you build it in release mode and try to run it?

some fresh rebuild log can also help..

greetings
Title: Re: Getting a basic wxSmith/wxWidgets to compile/link
Post by: ermano on April 08, 2014, 03:55:32 pm
Couldn't find the config file under the mentioned path (there seems to be no "App Data" or "Roaming" under Win7)

When I launch the "Hello World" equivalent of wxSmith in release mode it simply crashes immediately with windows telling me:
"xxx.exe has stopped working ..." and the infamous: "Windows can check online for a solution to the problem".

The same applies by the way for programs I have already written in the past (and that are supposed to work)

I could get it to work on my laptop (Win8) but on my win7 computer I'm still stuck.

This is the build log from the release compilation:

==============================================================================================
-------------- Clean: Release in test (compiler: GNU GCC Compiler)---------------

Cleaned "test - Release"

-------------- Build: Release in test (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -O2 -Wfloat-equal -Wextra -g -IC:\wxWidgets-3.0.0\include -IC:\wxWidgets-3.0.0\lib\gcc_dll\mswu -IC:\wxWidgets-3.0.0\include -IC:\wxWidgets-3.0.0\lib\gcc_dll -c C:\D\2014\Programming\test\wx_pch.h -o wx_pch.h.gch\Release_wx_pch_h_gch
windres.exe -IC:\wxWidgets-3.0.0\include -IC:\wxWidgets-3.0.0\lib\gcc_dll\mswu -IC:\wxWidgets-3.0.0\lib\gcc_dll -IC:\wxWidgets-3.0.0\include -J rc -O coff -i C:\D\2014\PROGRA~1\test\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -O2 -Wfloat-equal -Wextra -g -IC:\wxWidgets-3.0.0\include -IC:\wxWidgets-3.0.0\lib\gcc_dll\mswu -IC:\wxWidgets-3.0.0\include -IC:\wxWidgets-3.0.0\lib\gcc_dll -c C:\D\2014\Programming\test\testApp.cpp -o obj\Release\testApp.o
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Winvalid-pch -include wx_pch.h -DWX_PRECOMP -Wall -O2 -Wfloat-equal -Wextra -g -IC:\wxWidgets-3.0.0\include -IC:\wxWidgets-3.0.0\lib\gcc_dll\mswu -IC:\wxWidgets-3.0.0\include -IC:\wxWidgets-3.0.0\lib\gcc_dll -c C:\D\2014\Programming\test\testMain.cpp -o obj\Release\testMain.o
C:\D\2014\Programming\test\testMain.cpp:94:6: warning: unused parameter 'event' [-Wunused-parameter]
 void testFrame::OnQuit(wxCommandEvent& event)
      ^
C:\D\2014\Programming\test\testMain.cpp:99:6: warning: unused parameter 'event' [-Wunused-parameter]
 void testFrame::OnAbout(wxCommandEvent& event)
      ^
mingw32-g++.exe -LC:\wxWidgets-3.0.0\lib\gcc_dll -LC:\wxWidgets-3.0.0\lib\gcc_dll -o bin\Release\test.exe  obj\Release\testApp.o obj\Release\testMain.o obj\Release\resource.res -s -mthreads  -lwxmsw30u -mwindows
Output file is bin\Release\test.exe with size 559.50 KB
Process terminated with status 0 (0 minute(s), 16 second(s))
0 error(s), 2 warning(s) (0 minute(s), 16 second(s))
 

-------------- Run: Release in test (compiler: GNU GCC Compiler)---------------

Checking for existence: C:\D\2014\Programming\test\bin\Release\test.exe
Executing: "C:\D\2014\Programming\test\bin\Release\test.exe"  (in C:\D\2014\Programming\test\.)
Process terminated with status -1073741819 (0 minute(s), 2 second(s))
==============================================================================================


Thanx:  Hermann
Title: Re: Getting a basic wxSmith/wxWidgets to compile/link
Post by: BlueHazzard on April 08, 2014, 04:21:14 pm
The folder has to be there, but he is hidden. You have to enable hidden files...
The path is: C:\User\Username\AppData\Roaming\CodeBlocks

with your wxWidgets problem... i can't help you... i think the right please for this question would be the wxWidgets Forum....

(the right dlls are in place or?)

greetings
Title: Re: Getting a basic wxSmith/wxWidgets to compile/link
Post by: ermano on April 08, 2014, 05:52:09 pm
Wow, finally I got it to run !

I recompiled wxWidgets and saw it moaning about conflicts with my "Stawberry" (Perl) installation. (It came with a scientific software package).
Therefore I took out: "C:\Program Files (x86)\CMake 2.8\bin;C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;"
from my "Path" variable, rebooted and reinstalled/recompiled wxWidgets and than:
Surprise ! It worked !

Thanks BlueHazzard and all those that may have given it a thought:

Hermann