Thanks !!!
But I could not build CB : (wxwidgets was ok):
-------------- Build: src in Code::Blocks ---------------
mingw32-g++.exe -Ldevel -Lsrc\wxAUI -Lbase\tinyxml -LC:\wxMSW-2.8.10\lib\gcc_dll -LC:\MinGW\lib -o devel\codeblocks.exe .objs\src\app.o .objs\src\appglobals.o .objs\src\associations.o .objs\src\compilersettingsdlg.o .objs\src\crashhandler.o .objs\src\dlgabout.o .objs\src\dlgaboutplugin.o .objs\src\environmentsettingsdlg.o .objs\src\infopane.o .objs\src\ipc.o .objs\src\main.o .objs\src\printdlg.o .objs\src\scriptconsole.o .objs\src\scriptingsettingsdlg.o .objs\src\splashscreen.o .objs\src\startherepage.o .objs\src\resources\resources.res -Wl,--enable-auto-import -lcodeblocks -lwxaui -lwxscintilla -lshfolder -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwxmsw28u -mwindows
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Unregister':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:189: multiple definition of `_Unwind_SjLj_Unregister'
devel/libcodeblocks.a(d000028.o):(.text+0x0): first defined here
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Register':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:142: multiple definition of `_Unwind_SjLj_Register'
devel/libcodeblocks.a(d000025.o):(.text+0x0): first defined here
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Resume':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
devel/libcodeblocks.a(d000026.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 9 seconds)
3 errors, 0 warnings
-------------- Build: src in Code::Blocks ---------------
mingw32-g++.exe -Ldevel -Lsrc\wxAUI -Lbase\tinyxml -LC:\wxMSW-2.8.10\lib\gcc_dll -LC:\MinGW\lib -o devel\codeblocks.exe .objs\src\app.o .objs\src\appglobals.o .objs\src\associations.o .objs\src\compilersettingsdlg.o .objs\src\crashhandler.o .objs\src\dlgabout.o .objs\src\dlgaboutplugin.o .objs\src\environmentsettingsdlg.o .objs\src\infopane.o .objs\src\ipc.o .objs\src\main.o .objs\src\printdlg.o .objs\src\scriptconsole.o .objs\src\scriptingsettingsdlg.o .objs\src\splashscreen.o .objs\src\startherepage.o .objs\src\resources\resources.res -Wl,--enable-auto-import -lcodeblocks -lwxaui -lwxscintilla -lshfolder -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwxmsw28u -mwindows
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Unregister':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:189: multiple definition of `_Unwind_SjLj_Unregister'
devel/libcodeblocks.a(d000028.o):(.text+0x0): first defined here
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Register':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:142: multiple definition of `_Unwind_SjLj_Register'
devel/libcodeblocks.a(d000025.o):(.text+0x0): first defined here
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Resume':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
devel/libcodeblocks.a(d000026.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 9 seconds)
3 errors, 0 warnings
I think that's because you have installed gcc in 2 directories c:\mingw and d:\crossdev\b4.4.0-tdm-1 and pardon me if i'm wrong.
I have the same problem like killerbot.
By the way, I haven't rebuilt the wxWidgets library with gcc 4.4.(I use the old library built with tdm-gcc 3.3, is it the problem?)
[ 94.7%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -Iinclude -Iinclude\wxFlatNotebook\include -Iinclude\scripting\include -Iinclude\scripting\sqplus -ID:\wxWidgets-2.8.10\include -ID:\wxWidgets-2.8.10\lib\gcc_dll\mswu -Iinclude\wxscintilla\include -Iinclude\tinyxml -c F:\cb_svn\src\src\startherepage.cpp -o .objs\src\startherepage.o
[100.0%] g++.exe -Ldevel -Lsrc\wxAUI -Lbase\tinyxml -LD:\wxWidgets-2.8.10\lib\gcc_dll -o devel\codeblocks.exe .objs\src\app.o .objs\src\appglobals.o .objs\src\associations.o .objs\src\compilersettingsdlg.o .objs\src\crashhandler.o .objs\src\dlgabout.o .objs\src\dlgaboutplugin.o .objs\src\environmentsettingsdlg.o .objs\src\infopane.o .objs\src\ipc.o .objs\src\main.o .objs\src\printdlg.o .objs\src\scriptconsole.o .objs\src\scriptingsettingsdlg.o .objs\src\splashscreen.o .objs\src\startherepage.o .objs\src\resources\resources.res -Wl,--enable-auto-import -lcodeblocks -lwxaui -lwxscintilla -lshfolder -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwxmsw28u -mwindows
d:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Unregister':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:189: multiple definition of `_Unwind_SjLj_Unregister'
devel/libcodeblocks.dll.a(d000028.o):(.text+0x0): first defined here
d:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Register':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:142: multiple definition of `_Unwind_SjLj_Register'
devel/libcodeblocks.dll.a(d000025.o):(.text+0x0): first defined here
d:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Resume':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
devel/libcodeblocks.dll.a(d000026.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status
Process terminated with status 1 (3 minutes, 26 seconds)
3 errors, 27 warnings
My original TDM-MinGW was in D:\mingw.
I just update this folder with the new 4.4.0 version.
It seems there is no such folder named "d:\crossdev\b4.4.0-tdm-1". in my system. :D
Here's an issue I also discovered in a TDM 4.3.x.
When I compile some simple code I get errors on GCC's own headers [I don't have this with the latest MinGW 4.2.1], the issue also does not occur on linux (4.3.1).
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iosfwd:42,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ios:39,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/istream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/sstream:39,
from C:\view_vipnt_buildserver\vipnt\Codec\src\CodecDisplay.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
I can only get it to work when I use the following warning options :
-Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -pedantic -Wextra -Wall
-Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -pedantic -Wextra -Wall
Normally I use :
-Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -pedantic -std=c++98 -Wextra -Wall -ansi
So the moment I add any of these the error already occurs :
-std=c++98
-ansi
Is there any chance this can be fixed ??
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
You need to patch the cwchar header, others have done it http://www.nabble.com/-ANN--GCC-4.4.0-Released-td23207147.html
With that patch you can compile this new C++0x hello program (g++ hello.cpp -o hello.exe -std=c++0x)
#include <iostream>
#include <vector>
int main()
{
std::vector<char> v = {
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x43, 0x2b,
0x2b, 0x30, 0x78, 0x20, 0x57, 0x6f, 0x72, 0x6c,
0x64, 0x21 };
for (auto it = v.begin(); it != v.end(); ++it)
{
std::cout << *it;
}
std::cout << std::endl;
}
C++0x is cool!
I have been trying this for some time. I installed from the latest bundled installer, then I've got the new -2 packages seperately, still I keep getting the error. By the way, I'm linking with libsigc++, which was actually built using MinGW GCC 3.4.5. I'm pasting the error. Could someone help?
g++.exe -o dist/Debug/MinGW-Windows/urllib__ build/Debug/MinGW-Windows/urllibpp.o build/Debug/MinGW-Windows/main.o -L/C/Python26/libs -L/C/msys/1.0/local/lib -L../gtk+/lib -L/c/mingw/lib/gcc/mingw32/4.4.0 -lglibmm-2.4.dll -lpython26 -lboost_python-mgw44-mt-1_38 -lsigc-2.0 -lglib-2.0.dll
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Unregister':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:189: multiple definition of `_Unwind_SjLj_Unregister'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000019.o):(.text+0x0): first defined here
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Register':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:142: multiple definition of `_Unwind_SjLj_Register'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000016.o):(.text+0x0): first defined here
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Resume':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000017.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status
Hi.
I tried rebuilding libsigc++ from source with GCC 4.4.0-tdm-1 (r2), and the .a file I get here appears to have the _Unwind_* symbols.
I downloaded libsigc++-2.2.3 and tried building with the newer release. I did a make, and the library file got built successfully, but the test programs that come with the source didn't get built, and it gave the same redefinition of _Unwind_* found, even when it was using the newly built library files built by the same make command. I'm pasting the output here.
I'm not sure if I have missed something. Or is there something I should change in the makefile? Please advice.
g++ -shared -nostdlib c:/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../dllcrt2.o c:/mingw/bin/../lib/gcc/mingw32/4.4.0/crtbegin.o .libs/signal.o .libs/signal_base.o .libs/trackable.o .libs/connection.o .libs/slot.o .libs/slot_base.o .libs/lambda.o -Lc:/mingw/bin/../lib/gcc/mingw32/4.4.0 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.4.0/../../.. -L/mingw/lib -lstdc++ -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.4.0/crtend.o -Wl,--export-all-symbols -o .libs/libsigc-2.0-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libsigc-2.0.dll.a
Creating library file: .libs/libsigc-2.0.dll.a
copying selected object files to avoid basename conflicts...
rm -fr .libs/libsigc-2.0.lax
mkdir .libs/libsigc-2.0.lax
ar cru .libs/libsigc-2.0.a signal.o signal_base.o trackable.o connection.o slot.o slot_base.o lambda.o
ranlib .libs/libsigc-2.0.a
rm -fr .libs/libsigc-2.0.lax
creating libsigc-2.0.la
(cd .libs && rm -f libsigc-2.0.la && cp -p ../libsigc-2.0.la libsigc-2.0.la)
make[3]: Leaving directory `/c/opt/libsigc++-2.2.3/sigc++'
make[2]: Leaving directory `/c/opt/libsigc++-2.2.3/sigc++'
Making all in tests
make[2]: Entering directory `/c/opt/libsigc++-2.2.3/tests'
g++ -I. -I.. -I.. -I.. -g -O2 -MT test_trackable.o -MD -MP -MF .deps/test_trackable.Tpo -c -o test_trackable.o test_trackable.cc
mv -f .deps/test_trackable.Tpo .deps/test_trackable.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o test_trackable.exe test_trackable.o ../sigc++/libsigc-2.0.la
mkdir .libs
g++ -g -O2 -o .libs/test_trackable.exe test_trackable.o ../sigc++/.libs/libsigc-2.0.dll.a -L/usr/local/lib
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Unregister':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:189: multiple definition of `_Unwind_SjLj_Unregister'
../sigc++/.libs/libsigc-2.0.dll.a(d000019.o):(.text+0x0): first defined here
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Register':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:142: multiple definition of `_Unwind_SjLj_Register'
../sigc++/.libs/libsigc-2.0.dll.a(d000016.o):(.text+0x0): first defined here
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Resume':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
../sigc++/.libs/libsigc-2.0.dll.a(d000017.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [test_trackable.exe] Error 1
Hi, I found a problem that I can't set breakpoint in a inline function.
For example: I have three files:
main.cpp
#include <iostream>
using namespace std;
#include "a.h"
int main()
{
f1();
return 0;
}
a.cpp
#include "a.h"
void f2(){
f1();
}
a.h
inline void f1(){
int a=7;
a=a+1;
a=5;
};
Note, I can't set breakpoint in a.h in function f1().
When start debugging, I will receive this error from debugger(debug)
> break "C:/test/test_for_xiaowei/a.h:3"
Breakpoint 2 at 0x6: file C:/test/test_for_xiaowei/a.h, line 3. (2 locations)
>>>>>>cb_gdb:
> break "C:/test/test_for_xiaowei/main.cpp:11"
Breakpoint 3 at 0x401343: file C:\test\test_for_xiaowei\main.cpp, line 11.
>>>>>>cb_gdb:
> run
Warning:
Cannot insert breakpoint 2.
Error accessing memory address 0x6: Input/output error.
gdb: win32_init_thread_list
Any comments?
Thanks.
By the way ,I have tried many mingw package. Only TDM-MinGW can set breakpoints in a header file in CB :D
@John
Since the offical MinGW package abandon the SJLJ and use Dwarf-2 Unwinding by default.
Can TDM GCC do like this?
Thanks. :D
__attribute__ ((used)) is the canonical way of forcing gcc to emit a function body whether all calls are inlined or not. However, this is mostly useful for libraries or for cases where the compiler cannot possibly know that you call a function (out of inline assembly, for example). It's of little use for your debugging problem, as the function is never called, like in Ceniza's proposal.
Try __attribute__ ((noinline)), which prevents the compiler from inlining a particular function. This, however, only disables inlining, you may still face problems due to CSE and other optimisations which dead-strip function calls that have no effect.
If you want to prevent those too, use said attribute and add asm(""); in the function body. Due to the asm statement, the compiler cannot prove that no side effects take place, so it can't eleminate the function call.
EDIT:
Would have been good if I had looked at your code snippet too before answering. Class member declar-finitions as in your example are problematic. Why? Because the standard says (7.1.2.3) that these are inline, so it may be that the compiler still inlines those even if you tell it not to, as it's required by the language. Not sure what it does exactly, have to try.
Thank you for your help. I have tried these code below, but still has the same debug problem :(
a.h
__attribute__ ((noinline)) inline void f1(){
int a=7;
a=a+1;
a=5;
asm("");
};
By the way, I have tried another "Class member declar-finitions" examples.
main.cpp
#include <iostream>
using namespace std;
#include "a.h"
int main()
{
TestClass a;
a.func_inline();
return 0;
}
a.cpp
#include "a.h"
void f2(){
TestClass b;
b.func_inline();
}
a.h
class TestClass{
public:
void func_inline(){
int a;
a = 0;
a++;
}
};
And still I can't set breakpoint in "func_inline" function body. see below:
> break "C:/test/inline_2/main.cpp:12"
Breakpoint 2 at 0x401346: file C:\test\inline_2\main.cpp, line 12.
>>>>>>cb_gdb:
> break "C:/test/inline_2/a.h:7"
Breakpoint 3 at 0x6: file C:/test/inline_2/a.h, line 7. (2 locations)
>>>>>>cb_gdb:
> break "C:/test/inline_2/main.cpp:19"
No line 19 in file "C:\test\inline_2\main.cpp".
>>>>>>cb_gdb:
> run
Warning:
Cannot insert breakpoint 3.
Error accessing memory address 0x6: Input/output error.
Seems I can't find any way to solve this. :(
By the way , If I totally comment the code in
void f2(){
//TestClass b;
//b.func_inline();
}
then, breakpoint can be set successfully in header file. This is the same as my previous example, if an inline function be called only once, we can set breakpoints in function body. :D
Hi.
I searched on Google, but finally return to CB forum again. I find one solution that in this post by Jens.
http://forums.codeblocks.org/index.php/topic,9295.msg66259.html#msg66259
Using "-gstabs" in "Compiler settings -> Other options" instead works for me.
This can solve my problem! :shock:
Edit
I can set breakpoints in a header file, but the program will hit that breakpoint with no line information output :(. this method still can't work.
Breakpoint 3, 0x00418952 in f1 ()
>>>>>>cb_gdb:
> cont
Breakpoint 4, 0x0041895c in f1 ()
>>>>>>cb_gdb:
> cont
Breakpoint 2, main () at C:/test/inline_test/main.cpp:12
Edit2
If I use both -gstabs -gstabs+ , then the problem can totally be solved :D
Hello!
I got odd message with GCC 4.4.0-tdm-1-dw2 after "Compile current file" in C::B
Compiling: op\op.cpp
Linking console executable: op\op.exe
C:\mingw\lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
op\op.exe should not be linked at all... :shock: