All of a sudden my program refuse to execute

I was working on a very simple program that only uses the cmd to do stuff.
Then all of a sudden it stopped working.
It compiles and runs. But it instantly return 0; in main, without even running the code inside main!

I realised not even this line of code will run anymore:
1
2
3
4
5
6
7
8
#include <iostream>

using namespace std;
int main(){

    cout << "running";
    return 0;
}

It will only print "Process returned 0 (0x0)"...

I think my friend made an extra setting to allow to work with windows and buttons, but Im not sure what he did.
Im using codeblocks so maybe that is the error?
He's probably set your code to run in GUI mode, which completely removes the Console window.
Try creating another project in Console mode.
Check that. It is running console mode not gui mode :/
Maybe you should try resetting all the settings back to default? that might solve it.
Uninstalled and reinstalled the whole ide. Copy pasted the text in the files so that no config file would enter my new project.
Still, same problem remains. God I hate when shit like this happens to newbies.
Do you have to Log window visible in Code Blocks? Is it displaying anything funny when you go to compile the code again?
When I compile it says:
1
2
3
4
5
6
mingw32-g++.exe -Wall  -g     -c "C:\Users\Andreas\C++ Workspace\Testit\MainClass.cpp" -o obj\Debug\MainClass.o
mingw32-g++.exe -Wall  -g     -c "C:\Users\Andreas\C++ Workspace\Testit\Player.cpp" -o obj\Debug\Player.o
mingw32-g++.exe  -o bin\Debug\Testit.exe obj\Debug\MainClass.o obj\Debug\Player.o   -mwindows  
Output size is 979.95 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings (0 minutes, 1 seconds)

Perhaps it's that -mwindows that buggs it.. But Im not sure how to get rid of it..
It was the -mwindows that bugged me.
It was in settings>compiler>linker
something was written -mwindows
and that made the program run wrong main function I think..
-mwindows is used only when you write a GUI program, not a console application.
Topic archived. No new replies allowed.