Author Topic: Cygwin GCC compiler not building this simple program  (Read 3825 times)

Offline Spyro543

  • Single posting newcomer
  • *
  • Posts: 2
Cygwin GCC compiler not building this simple program
« on: November 06, 2011, 01:03:03 pm »
I've been trying to learn C++, but with a compiler that is refusing to work (or maybe I'm too n00bish to figure it out :P) it's kinda hard.
I set the default compiler to Cygwin GCC, set all the toolchain executables (C compiler -> gcc-3.exe, C++ compiler -> g++-3.exe), and typed in some code in my current project. It's just a very simple program:
Code
#include <iostream>
using namespace std;
int main()
{
    int a = 5;
    int b = 6;
    a = a + 5;
    int result = a + b;
    cout << "The result is " << result;
    return 0;
}
When I click Build and Run, I get a command prompt window with the following:
Code
      4 [main] ? 2488 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
Exception: STATUS_ACCESS_VIOLATION at eip=77AA47E5
eax=00000000 ebx=00000000 ecx=00000000 edx=7EFDD000 esi=00000000 edi=00400000
ebp=0028EEA4 esp=0028EE70 program=, pid 0, thread main
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame     Function  Args
0028EEA4  77AA47E5  (00400000, 00000000, 00000000, 0028EEE8)
0028EEB8  77AA2C54  (00400000, 00000001, 0028EFC0, 6104F4A6)
0028EEE8  6109A582  (00400000, FFFFFFFE, 0028EEE4, 77AA317F)
0028EFA8  61004A78  (0028EFC0, FFFFFFFF, 0000EEEE, 0028F8B8)
0028FF58  6100594F  (00000000, 00000000, 00000000, 00000000)
End of stack trace

Process returned -1073741819 (0xC0000005)   execution time : 10.676 s
Press any key to continue.
And in the build log I get:
Code
Checking for existence: C:\Users\Owner\Documents\C++Proj\C++ Experiments\bin\Release\C++ Experiments.exe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Users\Owner\Documents\C++Proj\C++ Experiments\bin\Release\C++ Experiments.exe"  (in C:\Users\Owner\Documents\C++Proj\C++ Experiments\.)
Process terminated with status -1073741819 (0 minutes, 52 seconds)
Anyone know what's wrong here? Any way I can fix it?
(Also, I got the version with mingw included but I can't find a way to get it working with CodeBlocks)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Cygwin GCC compiler not building this simple program
« Reply #1 on: November 06, 2011, 01:08:35 pm »
Anyone know what's wrong here? Any way I can fix it?
Most likely the application cannot find the Cygwin emulation layer. Try what happens if you compile at the command line. However, if you want to develop proper Windows applications, don't use Cygwin unless you have good reasons.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Cygwin GCC compiler not building this simple program
« Reply #2 on: November 06, 2011, 04:10:11 pm »
Yes, listen to Morten, it will be way easier if you use MinGW.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]