![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Oct 2009
Posts: 10
OS: XP
|
Programming Settings
i am a programmer who has just compiled a program in C++ but whenever i try to run the exe file it wont run because main() returns 0, and somewhere in my configuration settings is a setting that makes programs close when they return the value. Does anyone know how to turn off this setting or create a batch file to turn it off when my program runs?
Bobna (not real name) |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,880
OS: Vista, various linux distros
|
Re: Programming Settings
What tells you it wont run? Is there an error?
Because a lot of programs will return 0 as a standard, it's there to signify to the OS that the program ran successfully... There's not a setting you can change to kill any program that returns 0... So what is it that tells you it wont run? Cheers, Jamey |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Oct 2009
Posts: 10
OS: XP
|
Re: Programming Settings
i worked it out on another program from the internet-in the program tab under properties a box that had 'close on exit' written on it was checked.when i unchecked it stopped just executing for a second when i clicked on it to staying there. but when i looked under properties for the same checkbox in my program, it didnt have it?
|
|
|
|
|
|
#4 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,880
OS: Vista, various linux distros
|
Re: Programming Settings
Can you post your code? i think you may be falling into the common pitfall of not keeping your program running after it's done what you want it to...
|
|
|
|
|
|
#5 (permalink) |
|
Registered User
Join Date: Oct 2009
Posts: 10
OS: XP
|
Re: Programming Settings
i wont post the one im working on, its a private database, but heres a famous one that does the same thing on my computer:
#include <iostream> int main() { std::cout "Hello World!\n" return 0 } |
|
|
|
|
|
#7 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,880
OS: Vista, various linux distros
|
Re: Programming Settings
Yep, fix:
Code:
#include <iostream>
int main()
{
std::cout "Hello World!\n"
//wait for the user to dismiss the program(press enter)
cin.get();
return 0
}
Cheers, Jamey |
|
|
|
![]() |
| Thread Tools | |
|
|