Can't Get the Simplest of Programs to Work

I am still stuck just trying to get started. This has to be some kind of compiler problem or something, because the following code:

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

using namespace std;

int main()
{
    int var1 = 2;

    cout << var1;

    return 0;
}


produces this output for me:

"Process returned 1965940563 (0x752DDF53)   execution time : 0.697 s
Press any key to continue."


I am encountering multiple things that cause very simple programs to work, as previously shown here: http://www.cplusplus.com/forum/beginner/155972/

Doing things like having multiple cout commands adjacent to each other will cause it. Trying to assign a variable a value will do it. Trying to do basic math in the program will do it.

I know computers are very good at following the precise instructions you give them, which means I am telling it to do something I don't know that I am telling it. I am using Code::Blocks 13.12, the file name is main.cpp, and the compiler I told it to use is GNU GCC compiler. I am running Windows 8.1 on a 64 bit laptop. Is it perhaps I have bad compiler settings, or am labeling some metadata wrong, or something like that?
Last edited on
There is nothing wrong with your program.
It works for me using Visual Studio.
I know, that's the point, and why it is so frustrating.

Update: I just ran that code, plus the one in the link above, on another laptop I have that is running Ubuntu. Same version of Code::Blocks, same GNU GCC compiler. Both ran flawlessly. This seems to confirm it is a problem with the Windows laptop that I am not seeing. Does anyone have any ideas?
Are you sure you actually installed the gnu compiler chain? When you installed Code::Blocks did you install the version that includes the compiler?

Please show your build log.

mingw32-g++.exe   -c "C:\Users\mslas_000\Google Drive\LMD\Practice\PracticeCode\main.cpp" -o "C:\Users\mslas_000\Google Drive\LMD\Practice\PracticeCode\main.o"
mingw32-g++.exe  -o "C:\Users\mslas_000\Google Drive\LMD\Practice\PracticeCode\main.exe" "C:\Users\mslas_000\Google Drive\LMD\Practice\PracticeCode\main.o"   
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
Checking for existence: C:\Users\mslas_000\Google Drive\LMD\Practice\PracticeCode\main.exe
Executing: C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe "C:\Users\mslas_000\Google Drive\LMD\Practice\PracticeCode\main.exe" (in C:\Users\mslas_000\Google Drive\LMD\Practice\PracticeCode)
Process terminated with status 1965940563 (0 minute(s), 1 second(s))
 


Is that what you were looking for? Do I need to uninstall and reinstall the program?
I'm not a Windows user but does cb_console_runner.exe exist?

Topic archived. No new replies allowed.