I wrote a simple C ++ program that I compile with g ++ on the command line, and also run it through the command line. My program code is as follows:
#include<iostream> int main() { std::cout<<"Hello world"<<std::endl; return 0; }
When I run this code. I get the message "hello_world.exe has stopped working" on my office machine. But when I run the same part of the code at home, it works fine. Any idea why this is happening? Also, if I remove std :: endl, it works fine.
I am using Notepad ++ for code.
UPDATE: I do not run the same binary on both machines. I compile on both machines separately. I use Windows 7 32-bit windows in both places. I am using mingw. To compile, I enter "g ++ hello_world.cpp -o hello_world.exe". To run, I typed "hello_world.exe". I downloaded mingw from mingw.org and used "mingw-get-setup.exe" to install. And I installed g ++ and gcc through the command line using the command "mingw-get install gcc g ++".
Shaun source share