Jump to content
  • Advertisement
Sign in to follow this  
Devil0150

error when including iostream

This topic is 2263 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
How have you deduced that it is the inclusion of <iostream> that is causing this? Does the following program work?


#include <iostream>
int main() { return 0; }

Share this post


Link to post
Share on other sites
Something is seriously bork'd. Have you recently installed the IDE? What versions of code::blocks and compiler are you using? Can you get a stack trace of where the segfault occurs?

Share this post


Link to post
Share on other sites
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() (??:??)

Share this post


Link to post
Share on other sites
Which compiler are you using?

I don't believe that Visual C++ 2012 can build Windows XP applications without some semi-serious link-time hackery, in case you happen to be using a pre-release of that.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
I tried compiling from the command line with the example you gave me and it worked.
Yes, that compiler came with Code::Blocks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!