1

(Background: I always used to compile c++ codes through cmd-line using g++ at school's computers. It has been a while since I deleted any IDE on my laptop and I have downloaded NetBeans IDE a month ago.)

I am planning to do some c++ program practices and noticed that I'm having "Run failed" with exit value 127 (Build passes). I noticed from other posts that exit value 127 basically means the c++ compiler cannot identify 'string' variable types. Here is my code:

#include <iostream>
#include <string>

using namespace std;


/*
 * 
 */
int main(int argc, char** argv) {
    //Bunny bunny;

    string name;

    return 0;
}

As you can see, I have called <string> library that theoretically should enable the compiler to recognise string data type (or avoid run fail).

Edit: Here is the message regarding the 'Run fail' -

RUN FAILED (exit value 127, total time: 16ms)

My guess is that I need to install a program along with NetBeans for this to pass at 'Run'. I am quite bad at what is needed to install. Any help/suggestions will be appreciated.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Tenz
  • 21
  • 1
  • 6
  • _"I noticed from other posts that exit value 127 basically means the c++ compiler cannot identify 'string' variable types."_ That's certainly nothing happening on running a program. It's completely unclear for me what you are asking about? – πάντα ῥεῖ Feb 20 '16 at 18:32
  • 1
    @commenter above: that quote part was just a hint of my understanding regarding the 'Run failure' with exit value 127. My real question/concern is that I want to pass the run and be able to code using string data type without the Run fail – Tenz Feb 20 '16 at 18:52
  • 1
    If you were unable to use string data, you would get a compile error not a runtime error. Presumably you are getting more output than just "RUN FAILED", since your code compiles and runs in another environment: http://ideone.com/iPI3Hv – kfsone Feb 20 '16 at 19:00
  • @kfsone What I stated before was all that was in the output. The build was successful. And I had the run fail output as posted in my question's code (no "*more output than just "RUN FAILED"*"). I know that my code should work on your side (and thanks for the link). My main concern is that I'm missing something along with NetBeans – Tenz Feb 20 '16 at 22:10

1 Answers1

0

Okay, I have found a solution to my problem. This page had the same problem as me Why are all my C++ programs exiting with 0xc0000139? @Zell Faze. The steps I took to (identify my problem and) find that solution page was: I ran my c++ string code in debug mode and got the error code of 0xc0000139 and eventually found the solution page. So, to everyone in the future the cygwin modules for gcc-core and gcc-g++ latest versions had this bug where they didn't recognise string variables. I downgraded to version 4.9.3, same as Zell Faze in the referenced site. Hope this helps anyone (including the future forgetful me).

Community
  • 1
  • 1
Tenz
  • 21
  • 1
  • 6