Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 04-02-2005, 11:47 PM   #1
BSOD
 
Syn7ax 3rror's Avatar
 
Join Date: Apr 2005
Posts: 461
Send a message via AIM to Syn7ax 3rror Send a message via MSN to Syn7ax 3rror
Default Dev C++ help

Hello all. i just installed Dev C++ and tried to compile a program. But, when I hit "run", a window just flashed up for a milisecond then went away. Please tell me what I am doing wrong. It linked and compiled correctly and has no bugs.
__________________

Syn7ax 3rror is offline   Reply With Quote
Old 04-03-2005, 07:55 AM   #2
Fully Optimized
 
UK31337's Avatar
 
Join Date: Feb 2005
Posts: 2,776
Default

Chances are you're not doing anything wrong.

Add the following line to the end of your program:

Code:
system("pause");
Put it just before the final closing brace in int main()

You'll then see your window stay open and it'll say "Press any key to continue..." instead of just exiting.

To get around this problem without that extra code, just open up Command Prompt, navigate to the directory that contains your exe, and run it from there. The window won't close after you run the program.
__________________

UK31337 is offline   Reply With Quote
Old 04-03-2005, 11:20 AM   #3
BSOD
 
Syn7ax 3rror's Avatar
 
Join Date: Apr 2005
Posts: 461
Send a message via AIM to Syn7ax 3rror Send a message via MSN to Syn7ax 3rror
Default

Ahhhh. Thanks alot. If I want to open the cursor, where is it located.
Syn7ax 3rror is offline   Reply With Quote
Old 04-03-2005, 11:55 AM   #4
BSOD
 
Syn7ax 3rror's Avatar
 
Join Date: Apr 2005
Posts: 461
Send a message via AIM to Syn7ax 3rror Send a message via MSN to Syn7ax 3rror
Default

Ok heres what I got

code:

#include <iostream>

int main()
{
std::cout << "Hello World/n;"
;return 0;
system("PAUSE");

}

But when I complie it says done but when I hit run it syas "Project not compiled. I did a compile and run in one step and the cursor still flashed. Please help.
Syn7ax 3rror is offline   Reply With Quote
Old 04-03-2005, 04:13 PM   #5
Fully Optimized
 
UK31337's Avatar
 
Join Date: Feb 2005
Posts: 2,776
Default

I've changed your code as follows:

Code:
#include <iostream>

int main()
{
std::cout << "Hello World\n";
system("PAUSE");
return 0;
}
What I've put up there works perfectly for me. Make sure return 0; is the final statement (I was wrong earlier about system("pause"); being the last).

Note the ; comes at the end of the lines, not at the end of the text string.

Any more problems, feel free to let me know.
UK31337 is offline   Reply With Quote
Old 04-03-2005, 05:14 PM   #6
BSOD
 
Syn7ax 3rror's Avatar
 
Join Date: Apr 2005
Posts: 461
Send a message via AIM to Syn7ax 3rror Send a message via MSN to Syn7ax 3rror
Default

Ahhh. Tha's rite. Thanks!
__________________

Syn7ax 3rror is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 11:29 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0