For some time I didn't compile/run my programs using g++ in cmd and I only used CodeBlocks where I didn't have any problems so I don't know when this started.
So I tried to run a program that I compiled with 'g++ main.cpp' and it either wouldn't run at all, like nothing happened, or this would pop out. From a not so related answer in google I found that adding the -static-libstdc++ flag would fix this but I don't want to do this every time and the OCD in me wants to know why this is happening.
P.s. As mentioned in the title this only happens when the program has the string type in it. I also tried reinstalling Mingw but no luck.
As @n. 'pronouns' m instructed in the comments, I checked my %PATH% and found LyX, a Latex document processor which I don't even remember using, which for some reason also had the libstdc++-6.dll file. I uninstalled it and that fixed it.