Hi, John, thank you for the good work, I'm going to try your 32 bit dw2 edition now.
BTW, I just create a windows batch script to name all the *-dw2.exe files (strip the -dw2), hope that is useful for someone.
Setlocal EnableDelayedExpansion
for /f %%i in ('dir /b *-dw2.exe') do (
set name=%%i
set name=!name:-dw2=!
ren %%i !name!
)
Here is the output for a simple hello program in C and with gcc 4.71
-------------- Clean: Release in Hello_cpp (compiler: GNU GCC Compiler)---------------
Cleaned "Hello_cpp - Release"
-------------- Build: Release in Hello_cpp (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -pedantic-errors -v -c C:\Users\Gerard_2\Documents\Programmes_en_C\CodeBlocks\Hello_Cpp\Hello_cpp.cpp -o obj\Release\Hello_cpp.o
mingw32-g++.exe -o bin\Release\Hello_cpp.exe obj\Release\Hello_cpp.o
Using built-in specs.
COLLECT_GCC=mingw32-g++.exe
Target: mingw32
Configured with: ../../src/gcc-4.7.1/configure --build=mingw32 --enable-languages=c,c++,ada,fortran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto --enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-build-poststage1-with-cxx --disable-werror --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --enable-cxx-flags='-fno-function-sections -fno-data-sections' --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: win32
gcc version 4.7.1 (tdm-1)
COLLECT_GCC_OPTIONS='-Wall' '-pedantic-errors' '-v' '-c' '-o' 'obj\Release\Hello_cpp.o' '-mtune=i386' '-march=i386'
c:/mingw32/bin/../libexec/gcc/mingw32/4.7.1/cc1plus.exe -quiet -v -iprefix c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/ C:\Users\Gerard_2\Documents\Programmes_en_C\CodeBlocks\Hello_Cpp\Hello_cpp.cpp -quiet -dumpbase Hello_cpp.cpp -mtune=i386 -march=i386 -auxbase-strip obj\Release\Hello_cpp.o -Wall -pedantic-errors -version -o C:\Users\Gerard_2\AppData\Local\Temp\ccQneD7x.s
GNU C++ (tdm-1) version 4.7.1 (mingw32)
compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/../../../../mingw32/include"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++/mingw32"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++/backward"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.7.1/include"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.7.1/../../../../include"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.7.1/include-fixed"
ignoring nonexistent directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.7.1/../../../../mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/include/c++
c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/include/c++/mingw32
c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/include/c++/backward
c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/include
c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/../../../../include
c:\mingw32\bin\../lib/gcc/mingw32/4.7.1/include-fixed
End of search list.
GNU C++ (tdm-1) version 4.7.1 (mingw32)
compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1b05afeca9d712f769248af52f554d5e
COLLECT_GCC_OPTIONS='-Wall' '-pedantic-errors' '-v' '-c' '-o' 'obj\Release\Hello_cpp.o' '-mtune=i386' '-march=i386'
c:/mingw32/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/as.exe -v -o obj\Release\Hello_cpp.o C:\Users\Gerard_2\AppData\Local\Temp\ccQneD7x.s
GNU assembler version 2.22 (mingw32) using BFD version (GNU Binutils) 2.22
COMPILER_PATH=c:/mingw32/bin/../libexec/gcc/mingw32/4.7.1/;c:/mingw32/bin/../libexec/gcc/;c:/mingw32/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw32/bin/../lib/gcc/mingw32/4.7.1/;c:/mingw32/bin/../lib/gcc/;c:/mingw32/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/lib/;c:/mingw32/bin/../lib/gcc/mingw32/4.7.1/../../../
COLLECT_GCC_OPTIONS='-Wall' '-pedantic-errors' '-v' '-c' '-o' 'obj\Release\Hello_cpp.o' '-mtune=i386' '-march=i386'
Output file is bin\Release\Hello_cpp.exe with size 934.66 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
The same one for a compilation with gcc 4.81
-------------- Clean: Release in Hello_cpp (compiler: GNU GCC Compiler)---------------
Cleaned "Hello_cpp - Release"
-------------- Build: Release in Hello_cpp (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -pedantic-errors -v -c C:\Users\Gerard_2\Documents\Programmes_en_C\CodeBlocks\Hello_Cpp\Hello_cpp.cpp -o obj\Release\Hello_cpp.o
mingw32-g++.exe -o bin\Release\Hello_cpp.exe obj\Release\Hello_cpp.o
Using built-in specs.
COLLECT_GCC=mingw32-g++.exe
Target: mingw32
Configured with: ../../../src/gcc-4.8.1/configure --build=mingw32 --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --disable-symvers --enable-cxx-flags='-fno-function-sections -fno-data-sections -DWINPTHREAD_STATIC' --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 4.8.1 (tdm-1)
COLLECT_GCC_OPTIONS='-Wall' '-pedantic-errors' '-v' '-c' '-o' 'obj\Release\Hello_cpp.o' '-mtune=generic' '-march=pentiumpro'
c:/mingw32/bin/../libexec/gcc/mingw32/4.8.1/cc1plus.exe -quiet -v -iprefix c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/ -D_REENTRANT C:\Users\Gerard_2\Documents\Programmes_en_C\CodeBlocks\Hello_Cpp\Hello_cpp.cpp -quiet -dumpbase Hello_cpp.cpp -mtune=generic -march=pentiumpro -auxbase-strip obj\Release\Hello_cpp.o -Wall -pedantic-errors -version -o C:\Users\Gerard_2\AppData\Local\Temp\cccD6LPn.s
GNU C++ (tdm-1) version 4.8.1 (mingw32)
compiled by GNU C version 4.8.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.8.1/include/c++"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.8.1/include/c++/mingw32"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.8.1/include/c++/backward"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.8.1/include"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../include"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.8.1/include-fixed"
ignoring duplicate directory "c:/mingw32/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/include/c++
c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/include/c++/mingw32
c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/include/c++/backward
c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/include
c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/../../../../include
c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/include-fixed
c:\mingw32\bin\../lib/gcc/mingw32/4.8.1/../../../../mingw32/include
End of search list.
GNU C++ (tdm-1) version 4.8.1 (mingw32)
compiled by GNU C version 4.8.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ba981bdc3051a3f4991ef8e215402d9d
COLLECT_GCC_OPTIONS='-Wall' '-pedantic-errors' '-v' '-c' '-o' 'obj\Release\Hello_cpp.o' '-mtune=generic' '-march=pentiumpro'
c:/mingw32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/as.exe -v -o obj\Release\Hello_cpp.o C:\Users\Gerard_2\AppData\Local\Temp\cccD6LPn.s
GNU assembler version 2.23.1 (mingw32) using BFD version (GNU Binutils) 2.23.1
COMPILER_PATH=c:/mingw32/bin/../libexec/gcc/mingw32/4.8.1/;c:/mingw32/bin/../libexec/gcc/;c:/mingw32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw32/bin/../lib/gcc/mingw32/4.8.1/;c:/mingw32/bin/../lib/gcc/;c:/mingw32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/;c:/mingw32/bin/../lib/gcc/mingw32/4.8.1/../../../
COLLECT_GCC_OPTIONS='-Wall' '-pedantic-errors' '-v' '-c' '-o' 'obj\Release\Hello_cpp.o' '-mtune=generic' '-march=pentiumpro'
Output file is bin\Release\Hello_cpp.exe with size 1.14 MB
Process terminated with status 0 (0 minute(s), 11 second(s))
0 error(s), 0 warning(s) (0 minute(s), 11 second(s))
Thanks
gd_on
No wx -> no C::B with this version. I wonder how gd_on managed to be able to compile C::b already...?!
No, I haven't compiled C::B already! I just tried to, but aborted because need a click each time mingw-gcc is invoked !
And I have not even tried to compile wx 2.8.12, so ... probably a source for future problems, but I was prepared to...
gd_on
And another thing, not related to the previous problem, and not related to C::B, but more to tdm gfortran.
I tried to detect in a fortran program if it's compiled in 32 or 64 bits.
On your previous site, you said we could use conditional compilation. I tried such a code :
PROGRAM hello
! Does not work ?
#ifdef _WIN32
#ifdef _WIN64
print *, "Windows 64 bits compiler"
#else
print *, "Windows 32 bits compiler"
#endif
#endif
print *, "hello there Does this program work"
END
using -cpp during compilation to activate preprocessing.
But it does not work.
I remember that you said on your previous site version that those environment variables where set if you compile with 32 and/or 64 bit compiler. But I have not found this on your new design.
Do I miss something here too ?
It's not special to 4.81 version, was already there with 4.71.
gd_on
On a PC at work, I have finally been able to compile C::B with tdm 4.81 gcc ;). On this PC I have not the problem of "mingw32-gcc.exe - No disk; There are no disk in the drive. Insert a disk in \Device\Harddisk4\DR4", that I met on my own PC, at home >:(!
I use also the last updated tdm version with winapi 3.17.
Nevertheless, I have made a small modification within wxWidgets 2.8.12, because compile time was too huge, due to apparently the back tracking of a warning: there were so many warnings that after 4 hours of messages :o, I decided to stop compilation and tried to find a workaround. I had tons of messages like this one:
C:\wxWidgets-2.8.12\include/wx/debug.h:194:43: warning: typedef 'wxDummyCheckInt' locally defined but not used [-Wunused-local-typedefs]
#define wxFORCE_SEMICOLON typedef int wxDummyCheckInt
^
C:\wxWidgets-2.8.12\include/wx/debug.h:224:9: note: in expansion of macro 'wxFORCE_SEMICOLON'
wxFORCE_SEMICOLON /* just to force a semicolon */
^
C:\wxWidgets-2.8.12\include/wx/debug.h:233:38: note: in expansion of macro 'wxCHECK2_MSG'
#define wxCHECK_RET(cond, msg) wxCHECK2_MSG(cond, return, msg)
^
C:\wxWidgets-2.8.12\include/wx/buffer.h:289:9: note: in expansion of macro 'wxCHECK_RET'
wxCHECK_RET( m_bufdata->m_data, wxT("invalid wxMemoryBuffer") );
^
.....
in my C:\wxWidgets-2.8.12\include\wx folder, I have modified line 194 in debug.h:
original code:
#define wxFORCE_SEMICOLON typedef int wxDummyCheckInt
replaced by:
#define wxFORCE_SEMICOLON struct wxDummyCheckStruct /*typedef int wxDummyCheckInt*/
This is just a hack, because like that it's the same code for gnu and non-gnu gcc compilers, but it works.
Like that, I have been able to compile wxWidget 2.8.12 with gcc 4.8.1, with largely less warnings that without my hack (there are still a few ones!).
And build a new C::B version with gcc 4.81 too (in a few minutes, as usual).
I was not totally sure it will work because of the chicken and egg problem: who is the first?
Effectively, my old version of C::B was compiled with tdm 4.71, my new wxWidgets libraries and dll were compiled with gcc 4.81. But after some tries, it's OK.
Certainly, the order in which you build wxWidgets and intermediate C::B versions is important, because at certain step I had mixed things between 4.71 and 4.81 versions.
If this can help ...
gd_on
[attachment deleted by admin]
To gd_on: I would just turn off the "-Wunused-local-typedefs" warning instead.
You way might be faster; but, that way is safer.
Tim S.
I built wx2.8.12 lib by the command
cd wxWidgets-2.8.12\build\msw
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport" >log.txt 2>&1
Then I got a log.txt file which have 111460 lines. (mostly of the lines are the warning messages like: ...warning: typedef 'wxDummyCheckInt' locally defined but not used [-Wunused-local-typedefs].....)
So, maybe, I need to use:
cd wxWidgets-2.8.12\build\msw
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport -Wno-unused-local-typedefs" >log.txt 2>&1
to reduce the warnings, right?
Bug report about TDM-GCC 4.8.1 32bit dw2 version.
As you can see that I have report that wxWidgets's sample "excep" get crashed under TDM-GCC-dw2, to reproduce this bug, I create a minimal simple project.
I can confirm that this bug is specific to TDM-GCC. No ETA for a fix yet.
-John E. / TDM
@John, I found a strange thing, today I use mingw-builds x32-4.8.1-posix-dwarf-rev5 to build wx2.8.12, and I see that Except sample still crash, call stack below:
[debug]> bt 30
[debug]#0 0x7c90e514 in ntdll!KiFastSystemCallRet () from C:\WINDOWS\system32\ntdll.dll
[debug]#1 0x7e419418 in WaitMessage () from C:\WINDOWS\system32\user32.dll
[debug]#2 0x7e42770a in USER32!CallMsgFilterW () from C:\WINDOWS\system32\user32.dll
[debug]#3 0x7e4249c4 in USER32!GetCursorFrameInfo () from C:\WINDOWS\system32\user32.dll
[debug]#4 0x7e43a956 in USER32!SoftModalMessageBox () from C:\WINDOWS\system32\user32.dll
[debug]#5 0x7e43a2bc in USER32!MessageBoxIndirectA () from C:\WINDOWS\system32\user32.dll
[debug]#6 0x7e4663fd in USER32!MessageBoxTimeoutW () from C:\WINDOWS\system32\user32.dll
[debug]#7 0x7e4664a2 in USER32!MessageBoxTimeoutA () from C:\WINDOWS\system32\user32.dll
[debug]#8 0x7e450877 in USER32!MessageBoxExA () from C:\WINDOWS\system32\user32.dll
[debug]#9 0x7e45082f in USER32!MessageBoxA () from C:\WINDOWS\system32\user32.dll
[debug]#10 0x77c39300 in strerror () from C:\WINDOWS\system32\msvcrt.dll
[debug]#11 0x77c3b127 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
[debug]#12 0x77c36bba in msvcrt!abort () from C:\WINDOWS\system32\msvcrt.dll
[debug]#13 0x0000000a in ?? ()
[debug]#14 0x6fc5a09d in libstdc++-6!_ZN9__gnu_cxx27__verbose_terminate_handlerEv () from D:\mingw-builds\x32-4.8.1-posix-dwarf-rev5\mingw32\bin\libstdc++-6.dll
[debug]#15 0x6fc54fe9 in libstdc++-6!_ZN10__cxxabiv111__terminateEPFvvE () from D:\mingw-builds\x32-4.8.1-posix-dwarf-rev5\mingw32\bin\libstdc++-6.dll
[debug]#16 0x6fca82f0 in libstdc++-6!_ZSt9terminatev () from D:\mingw-builds\x32-4.8.1-posix-dwarf-rev5\mingw32\bin\libstdc++-6.dll
[debug]#17 0x6fcadc1c in libstdc++-6!__cxa_throw () from D:\mingw-builds\x32-4.8.1-posix-dwarf-rev5\mingw32\bin\libstdc++-6.dll
[debug]#18 0x0040233b in MyFrame::OnThrowInt (this=0xb25cd0) at D:\exception\aaa\aaaMain.cpp:417
[debug]#19 0x627015f1 in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#20 0x6276a07e in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#21 0x6276a14a in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#22 0x6276a545 in wxEvtHandler::ProcessEvent(wxEvent&) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#23 0x004021dc in MyFrame::ProcessEvent (this=0xb25cd0, event=...) at D:\exception\aaa\aaaMain.cpp:382
[debug]#24 0x62804dc7 in wxFrameBase::ProcessCommand(int) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#25 0x627b9d64 in wxFrame::HandleCommand(unsigned short, unsigned short, void*) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#26 0x627ba173 in wxFrame::MSWWindowProc(unsigned int, unsigned int, long) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#27 0x627a0cee in wxWndProc(HWND__*, unsigned int, unsigned int, long)@16 () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#28 0x7e418734 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
[debug]#29 0x000a0528 in ?? ()
[debug](More stack frames follow...)
The exception was throw from #18 0x0040233b in MyFrame::OnThrowInt (this=0xb25cd0) at D:\exception\aaa\aaaMain.cpp:417.
But mingw-builds x32-4.8.1-posix-dwarf-rev5 can successfully run my Test Case2.
EDIT:
I just test the official MinGW GCC 4.8.1 which is dw2 by default, I also successfully pass the Case2 program, but crash happens when I run except sample code. BTW, to build the wxWidgets 2.8.12 by official MinGW 4.8.1, you need to change the header file:
edit line 2217 of /mingw/include/commctrl.h to read
#define TV_DISPINFO NMTVDISPINFO
instead of
#define TV_DISPINFO __AW(NMTVDISPINFO)
See: [Mingw-users] win32api version 4 (http://sourceforge.net/mailarchive/message.php?msg_id=31361645)
The wxWidgets sample crashes because it tries to throw the exception through the Windows runtime from a callback to the wxWidgets event handler. This is not supported with DW2 exception unwinding. Your test case doesn't throw through a Windows callback, which is why it works as it should under mingw-builds and MinGW.org; it exhibits a bug specific to TDM-GCC.
-John E. / TDM
Thanks, I know that exception can not propagate through a non-mingw build frame, but what the wxWidgets' except sample do is:
1, write a overload function the MyFrame::ProcessEvent, and write a try block there:
bool MyFrame::ProcessEvent(wxEvent& event)
{
try
{
return wxFrame::ProcessEvent(event);
}
catch ( const wxChar *msg )
{
wxLogMessage(_T("Caught a string \"%s\" in MyFrame"), msg);
return true;
}
}
2, I think all the function up to the MyFrame::ProcessEvent is all build from the same MinGW compiler, see the call stack:
[debug]#18 0x0040233b in MyFrame::OnThrowInt (this=0xb25cd0) at D:\exception\aaa\aaaMain.cpp:417
[debug]#19 0x627015f1 in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#20 0x6276a07e in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#21 0x6276a14a in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#22 0x6276a545 in wxEvtHandler::ProcessEvent(wxEvent&) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#23 0x004021dc in MyFrame::ProcessEvent (this=0xb25cd0, event=...) at D:\exception\aaa\aaaMain.cpp:382
[debug]#24 0x62804dc7 in wxFrameBase::ProcessCommand(int) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#25 0x627b9d64 in wxFrame::HandleCommand(unsigned short, unsigned short, void*) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#26 0x627ba173 in wxFrame::MSWWindowProc(unsigned int, unsigned int, long) () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#27 0x627a0cee in wxWndProc(HWND__*, unsigned int, unsigned int, long)@16 () from E:\code\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
[debug]#28 0x7e418734 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
[debug]#29 0x000a0528 in ?? ()
You see, the call back is infact the function wxWndProc (#27), and in #23 0x004021dc in MyFrame::ProcessEvent, there is a try catch block. So, I think there is not chance that the exception will go up to the Windows call back function, which is #27 0x627a0cee in wxWndProc.
Am I right?
EDIT: the code below works correctly, my question is: it looks like exception can not propagate up cross the event handler function.
void f()
{
throw 1;
}
void MyFrame::OnThrowInt(wxCommandEvent& WXUNUSED(event))
{
//throw -17;
try
{
f();
}
catch ( int i )
{
wxLogWarning(_T("Caught an int %d in MyApp."), i);
}
}
EDIT2
@John, you are right. I have a mistake, because the original try catch block can not catch int type.
bool MyFrame::ProcessEvent(wxEvent& event)
{
try
{
return wxFrame::ProcessEvent(event);
}
catch ( const wxChar *msg )
{
wxLogMessage(_T("Caught a string \"%s\" in MyFrame"), msg);
return true;
}
}
If I add one catch clause (catch ( int i )) here
bool MyFrame::ProcessEvent(wxEvent& event)
{
try
{
return wxFrame::ProcessEvent(event);
}
catch ( int i )
{
wxLogWarning(_T("Caught an int %d in MyFrame."), i);
return true;
}
catch ( const wxChar *msg )
{
wxLogMessage(_T("Caught a string \"%s\" in MyFrame"), msg);
return true;
}
}
then I can correctly catch this int type exception.
I see that the except sample code do have another level of try/catch block in the app level.
bool MyApp::OnExceptionInMainLoop()
{
try
{
throw;
}
catch ( int i )
{
wxLogWarning(_T("Caught an int %d in MyApp."), i);
}
catch ( MyException& e )
{
wxLogWarning(_T("Caught MyException(%s) in MyApp."), e.what());
}
catch ( ... )
{
throw;
}
return true;
}
This try block is far up in the call stack train (cross the Windows call back function call), so exception(build with gcc-dw2) can not go there.
Sorry about the noise.
To gd_on: I would just turn off the "-Wunused-local-typedefs" warning instead.
You way might be faster; but, that way is safer.
Tim S.
I built wx2.8.12 lib by the command
cd wxWidgets-2.8.12\build\msw
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport" >log.txt 2>&1
Then I got a log.txt file which have 111460 lines. (mostly of the lines are the warning messages like: ...warning: typedef 'wxDummyCheckInt' locally defined but not used [-Wunused-local-typedefs].....)
So, maybe, I need to use:
cd wxWidgets-2.8.12\build\msw
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release CXXFLAGS="-fno-keep-inline-dllexport -Wno-unused-local-typedefs" >log.txt 2>&1
to reduce the warnings, right?
ollydbg, I have done this myself and many warning messages were logged in a file of mine, which reports far too many warning messages to list them here in a code tag ( I have tried, that's why I said "far too many"; I can't post it due to over excessive line usage lol).
Also, another serious issue is with existing wxMSW projects I have already created. I have tried to recompile them with the currently compiled files, and it seems there's an issue with .rc files:
||=== Build: Debug in wxCartridgeStockTaking (compiler: GNU GCC Compiler) ===|
C:\Users\stefanos\GENERAL\Projects\WXPROJ~1\WXCART~1\resource.rc|3|fatal error: wx/msw/wx.rc: No such file or directory|
||can't open icon file `wx/msw/std.ico': No such file or directory|
||preprocessing failed.|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
With tdm's gcc 4.7.1 (32-bit), I did not have such issue before. Anyone else had anything similar to this?