I'm getting a runtime error when I include iostream in my program. This is the error:
Program received signal SIGSEGV, Segmentation fault.
In ntdll!RtlpWaitForCriticalSection () (C:\WINDOWS\system32\ntdll.dll)
I'm using Code::Blocks on windows XP.
Any ideas on how to fix this?
13 replies to this topic
Sponsor:
#5 Members - Reputation: 140
Posted 06 April 2012 - 07:19 AM
I installed the IDE yesterday. I'm using Code::Blocks release 10.05 rev 6283. Here is the stack trace:
#0 7C91B1FA ntdll!RtlpWaitForCriticalSection() (C:\WINDOWS\system32\ntdll.dll:??)
#1 7C901046 ntdll!RtlEnumerateGenericTableLikeADirectory() (C:\WINDOWS\system32\ntdll.dll:??)
#2 00000000 0x00dae7b0 in ??() (??:??)
#3 77C3B90D msvcrt!_lock() (C:\WINDOWS\system32\msvcrt.dll:??)
#4 77C3EF1A msvcrt!fflush() (C:\WINDOWS\system32\msvcrt.dll:??)
#5 73DAE790 iob() (C:\WINDOWS\system32\crtdll.dll:??)
#6 00000000 0x00000020 in ??() (??:??)
#7 00000000 0x002541b0 in ??() (??:??)
#8 00000000 0x00000001 in ??() (??:??)
#9 00000000 0x00000001 in ??() (??:??)
#10 00000000 0x0022fe14 in ??() (??:??)
#11 00000000 0x0046c2f0 in __DTOR_LIST__() (??:??)
#12 00000000 0x0022ffe0 in ??() (??:??)
#13 77C35C94 msvcrt!_except_handler2() (C:\WINDOWS\system32\msvcrt.dll:??)
#14 00000000 0x0044611f in std::ostream::flush() (??:??)
#0 7C91B1FA ntdll!RtlpWaitForCriticalSection() (C:\WINDOWS\system32\ntdll.dll:??)
#1 7C901046 ntdll!RtlEnumerateGenericTableLikeADirectory() (C:\WINDOWS\system32\ntdll.dll:??)
#2 00000000 0x00dae7b0 in ??() (??:??)
#3 77C3B90D msvcrt!_lock() (C:\WINDOWS\system32\msvcrt.dll:??)
#4 77C3EF1A msvcrt!fflush() (C:\WINDOWS\system32\msvcrt.dll:??)
#5 73DAE790 iob() (C:\WINDOWS\system32\crtdll.dll:??)
#6 00000000 0x00000020 in ??() (??:??)
#7 00000000 0x002541b0 in ??() (??:??)
#8 00000000 0x00000001 in ??() (??:??)
#9 00000000 0x00000001 in ??() (??:??)
#10 00000000 0x0022fe14 in ??() (??:??)
#11 00000000 0x0046c2f0 in __DTOR_LIST__() (??:??)
#12 00000000 0x0022ffe0 in ??() (??:??)
#13 77C35C94 msvcrt!_except_handler2() (C:\WINDOWS\system32\msvcrt.dll:??)
#14 00000000 0x0044611f in std::ostream::flush() (??:??)
#8 Members - Reputation: 2049
Posted 06 April 2012 - 01:54 PM
Can you compile a simple application on the command line that behaves properly? e.g.
C:\path\to\g++ main.cpp -o main.exe -ansi -pedantic
Does 4.4.1-tdm-2 come with Code::Blocks? There are more recent versions of g++ from the official MinGW distribution.
C:\path\to\g++ main.cpp -o main.exe -ansi -pedantic
Does 4.4.1-tdm-2 come with Code::Blocks? There are more recent versions of g++ from the official MinGW distribution.
#12 Members - Reputation: 2049
Posted 07 April 2012 - 03:17 PM
What are the commands that Code::Blocks is issuing? i.e. can you find the exact executable paths and list the command line parameters that are being given to them?
If you can, try to build a small program yourself in exactly the same way. If that program runs correctly, we'll have to look at something else. If Code::Blocks is running your builds through gdb, it could be the particular build of gdb that's at fault.
Alternatively, can you find and run the executable that Code::Blocks built for you and run it directly from explorer or the command shell?
If you can, try to build a small program yourself in exactly the same way. If that program runs correctly, we'll have to look at something else. If Code::Blocks is running your builds through gdb, it could be the particular build of gdb that's at fault.
Alternatively, can you find and run the executable that Code::Blocks built for you and run it directly from explorer or the command shell?
#13 Members - Reputation: 140
Posted 08 April 2012 - 02:26 AM
I found what was wrong. In the link libraries list, I had included all the libraries in the MinGW\lib folder.
I am used to doing that, I can't remember why, and I didn't have a problem with it before cause I haven't work on a console project with iostream for a long time.
I removed all the libraries from the link libraries list and it worked fine.Thx
I am used to doing that, I can't remember why, and I didn't have a problem with it before cause I haven't work on a console project with iostream for a long time.
I removed all the libraries from the link libraries list and it worked fine.Thx
#14 Moderators - Reputation: 8419
Posted 08 April 2012 - 08:22 PM
Please don't mark threads "solved."
Thanks!
Thanks!
Maker of Machinery
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]






