July 30th, 2003, 10:55 PM
.EXE doesn´t work... (Newbie)
Hi, after I built a little program I tried to use just the file .EXE on another computer, but I was unable to execute it. Why ?? Do I need to have more files accompaning this .EXE file ??
Thank you !!!
July 30th, 2003, 11:09 PM
most likely you probably double clicked the exe im guessing? what you need to do is open up a command prompt, and change to the directory the exe is located and then run it. another neat little trick people use is to insert this as the last line in your program:
that will wait for input from the user b4 closing the window. if you add that code, then you will be able to just double click the exe instead of having to run it from the command prompt.
July 31st, 2003, 02:42 AM
If you compiled it with a student or learning edition of Visual C++, you cannot run it on another computer--you have to upgrade to the Professional edition to do that. That's to prevent you from distriubuting apps--e.g commercial development--without paying the full fee.
August 1st, 2003, 07:47 AM
cin.getch() completely destroyed my program and I couldnt compile anything till I cleared out all my projects and restarted my comp....but as for the other one(command line) that helped :-D Where exactly does cin.getch() go? before or after the return 0; line? I put it before, so it might've been my mistake, otherwise my compiler doesnt like that command :-P
August 1st, 2003, 08:45 AM
cin.getch() simply reads a character from standard input (eg ther keyboard). However (IIRC) it waits for the Enter key to be hit before it returns the first character entered.
The reason it probably "broke your program" is that, to use the cin object (or cout, cerr) you also need to #include <iostream> (and probably also a
using namespace std;
as cin lives in the std namespace.
Note: std::cin is also C++ specific, and not available from standard C.
August 2nd, 2003, 09:54 PM
hmm i think my computer was just going nuts, i think when i tried the compile i was running too much and it crashed it, thus making the compiler act weird. anyway, i think i understand that now, very useful, thanks :D I'm on day 6 of the 21 day program of learning C++, but something tells me that will translate to many months :p