0

Something happened to my compiler, and now I can't even compile hello world. Here's a link to error that I'm getting https://pastebin.com/HtyUdz6f , looks like my std libraries broken or something. How I can fix this problem ?

#include <iostream>
using namespace std;

int main()
{
    cout<<"Hello World";

    return 0;
}
genpfault
  • 51,148
  • 11
  • 85
  • 139
maksasj
  • 13
  • 3
  • 1
    Path of least resistance will probably be move the compiler and supporting tools off to a back-up folder and then reinstall the compiler. If you care enough you can diff the reinstall against the back-up folder. – user4581301 Mar 18 '22 at 19:46
  • What was changed on your system since the last time it worked? – lurker Mar 18 '22 at 19:49
  • lurker, I was working on my project, I decided to take a break and watch YouTube. After that I installed telegram. And after that compiler stopped working properly. It is very doubtful that any of the above could affect the compiler. – maksasj Mar 18 '22 at 19:56
  • 2
    Looks like you either modified some system headers inadvertenly, or you have several MinGW versions installed that conflict with each other. Uninstall all of them, and install one again (preferably the one from [MSYS2](https://stackoverflow.com/q/30069830/2752075)). – HolyBlackCat Mar 18 '22 at 20:39
  • Use `@username` when replying, otherwise people don't get notifications. – HolyBlackCat Mar 18 '22 at 20:40
  • 1
    I have accidentally nuked library headers while debugging. The debugger steps into, say ``, and then an accidental key press followed by not paying enough attention to the prompts when saving files and that's all she wrote. Don't give yourself write access. – user4581301 Mar 18 '22 at 22:37

2 Answers2

0

Try with a different compiler. You're using MinGW-w64 8.1.0, but it could be broken somehow.

An easy way to test your code would be to get a (more up to date) standalone build from https://winlibs.com/ and extract it in a different folder and compile your example with that. It won't interfere with your installed version and when done you can just remove the folder.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40
0

This code compiles and runs on other C++ compilers, therefore the problem is likely caused by the compiler, not by the program itself.

MinGW-w64 8.1.0 has not been updated since 2018, and will most likely stay without updates in the near future. Therefore, the software likely no longer works on modern software/operating systems. You may need to use a different compiler such as Visual Studio. If you are not able to use a different compiler, deleting, then reinstalling MinGW-w64 8.1.0 may solve the issues with the compiler.