Code::Blocks Forums

User forums => Help => Topic started by: quesoesbueno59 on July 30, 2009, 03:05:06 am

Title: Problems Running Programs
Post by: quesoesbueno59 on July 30, 2009, 03:05:06 am
I am new to programming, and started with Code::Blocks since it was recommended by the online tutorials I'm doing. I made my Hello World program, and when I clicked on Build and Run in the drop down menu, it compiled but it didn't run. I went to look for the executable in the project folder, and I found it. I double clicked on it and a DOS window popped open then immediately closed. I couldn't read what it said, but it probably wasn't good. Any help?
Title: Re: Problems Running Programs
Post by: Soulou on July 31, 2009, 03:41:33 pm
Hello,

It's a common problem, but this problem isn't one ^^. In fact, when you launch your program, nothing says that it must run after your Hello World.
There are two solutions :
- You can open a command prompt before and run pathtoyourprogram\yourprogram.exe
- You can add the function
Code
getchar();
before
Code
 return 0;
in your program, getchar ask the program to wait that you type a char.