1

I am trying to print a formatted string in C++ in netbeans :

#include <iostream>
#include <string>
using namespace std;

int main() {
  string  name = "mark";
  cout << "My name is " << name << " years old.";
  return 0;
}

but I get the error:

RUN FAILED (exit value -1,073,741,511, total time: 37ms)

why is this?

Oto-obong Eshiett
  • 1,459
  • 3
  • 18
  • 33
  • 1
    That number is 0xC0000139 which is dll not found – Mike Vine Apr 13 '20 at 17:34
  • Note: When you see a bonkers number like -1,073,741,511, convert it to hex (0xC0000139) and see if it becomes something more recognizable. Entry Point Not Found is an odd error here. Usually that means a DLL is missing somewhere. You're not doing anything fancy here, so I'm thinking your development environment install is broken. Can you track down the executable that should have been compiled for you and run the program from the command line? – user4581301 Apr 13 '20 at 17:34
  • My guess is the dlls for your compiler's runtime are not in a folder that is in your `PATH` environment variable. This is one place that in `c++` where you will need a better understanding on how your OS works. This may help: [https://stackoverflow.com/questions/2463243/dll-search-on-windows](https://stackoverflow.com/questions/2463243/dll-search-on-windows) – drescherjm Apr 13 '20 at 17:36
  • This could also be caused by having multiple versions of your compiler installed. I am thinlking in the case of mingw. Perhaps you have an older version of mingw installed in your PATH before the current version and windows finds the old dll first becuase of the search order. – drescherjm Apr 13 '20 at 17:42
  • There is not any issue with your code as It is getting compiled in my machine.All that is causing issue is the PATH variable in which you have specified you compiler path.Just make sure if the path of the compiler is correctly given in the PATH variable.Hope this will resove the issue. – Chandra Shekhar Apr 13 '20 at 19:48

0 Answers0