Wednesday, July 8, 2009

Dev-C++ Execution Termination?

________________________________________...


Compiler: Default compiler


Building Makefile: "C:\Dev-Cpp\Makefile.win"


Executing make...


make.exe -f "C:\Dev-Cpp\Makefile.win" all


g++.exe -c "Hello code.cpp" -o "Hello code.o" -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/incl... -I"C:/Dev-Cpp/include/c++/3.4.2/backward... -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"





g++.exe "Hello code.o" -o "Hello World.exe" -L"C:/Dev-Cpp/lib" -mwindows





g++.exe "Hello code.o" -o "Hello World.exe" -L"C:/Dev-Cpp/lib" -mwindows





Execution terminated


Compilation successful


______________________________________...


That's the compile log.


here is the code.


______________________________________...


// my first program in C++





#include %26lt;iostream%26gt;


using namespace std;





int main ()


{


cout %26lt;%26lt; "Hello World!";


return 0;


}


______________________________________...


What's the problem?

Dev-C++ Execution Termination?
put this code after: cout %26lt;%26lt; "Hello World!"





for example:








#include %26lt;iostream%26gt;


using namespace std;





int main ()


{


cout %26lt;%26lt; "Hello World!";


cin.ignore(256, '\n');


cout %26lt;%26lt; "Press ENTER to continue..." %26lt;%26lt; endl;


cin.get();


return 0;


}





tested on DEV-C++
Reply:TRY THIS:





#include %26lt;iostream%26gt;


using namespace std;





int main ()


{


cout %26lt;%26lt; "Hello World!";


system ("pause");


return 0;


} Report It

Reply:there doesn't appear to be ANY problem. Execution terminated just means that it is finished doing what it is doing. note that it says "Compilation successful" after that. it means it worked. try running the program. it should work just fine.
Reply:Well, FER has the solution and I have the 2 possible explanations.





1. When you ran the program ( Execute / Run ) it probably popped open the DOS box and then closed it so fast that the human eye couldn't see it. It would do this since the line 'return 0;' in main does just that and Windows (being ever so tidy!) cleans it off the screen immediately.





2. On occasion, I've forgotten that I have to actually run it after I compile it!





The fix above holds the DOS box open until you hit a key, any key. Then it will close.

mint

No comments:

Post a Comment