Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: faculaganymede on February 12, 2014, 02:20:08 am

Title: GCC segmentation fault with exp(complex<double>)
Post by: faculaganymede on February 12, 2014, 02:20:08 am
I installed codeblocks-13.12mingw-setup.exe on Windows 7.  The following C++ code is giving a segmentation fault.  Does anyone know why??

I'm using the GNU GCC compiler that came with the codeblocks installer.  Error seems to be compiler related.  Code runs fine if I enable any of the optimization flags (i.e. -O, -O1, -O2, etc.), but errors at the exp() call if none of the optimization flags is selected.

Code
#include <iostream>
#include <complex>
using namespace std;

int main ()
{
    complex<double> cc;
    cc = exp(complex<double>(0.0,1.0));
    return 0;
}
Title: Re: GCC segmentation fault with exp(complex<double>)
Post by: Jenna on February 12, 2014, 06:25:25 am
Please (re-?)read the forum rules.
Especially:
[...]
2. Compiler/Linker errors are NOT Code::Blocks errors. Usually, C++ newcomers tend to confuse the Editor/IDE (Code::Blocks) with the Compiler (MINGW / GCC). You may see some errors in the compiler output because you missed to do something right in your code. But that's not Code::Blocks troubleshooting, that's C++ troubleshooting and does not belong in here. If your program doesn't compile, READ THE C++ MANUAL.
[...]
Finale note: Ignoring these rules may result in the topic being (silently) locked and/or even removed completely without any notice.

In case you wonder why we are so strict: I could say: "Search the forum" - as this has been discussed a lot. To make is short: By law we (the devs/moderators) are responsible for the content of our forum. This means we need to read all posts. If you want us to continue the development of C::B and have the time to answer some of the questions that are really related to C::B, apply the rules above. It's obviously a matter of time for us.

More general help how to use our forum you'll find here (http://forums.codeblocks.org/index.php?action=help), too.

Topic locked !