Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: seventhmoon on February 06, 2006, 09:09:48 pm

Title: making a working .exe than i can send to other people
Post by: seventhmoon on February 06, 2006, 09:09:48 pm
I'm new to C++. I've just made my first Hello World application, and I've run it and it runs fine. I was wondering  how I can 'Publish' a working .exe that I can send to other people (just an example). There is a exe in my project folder but when i click on it it pops up very fast and the closes.

Title: Re: making a working .exe than i can send to other people
Post by: sethjackson on February 06, 2006, 09:39:32 pm
Add this before return 0;

Code: cpp
std::cout << std::endl << "Press Enter to exit.";

std::cin.get();
Title: Re: making a working .exe than i can send to other people
Post by: thomas on February 06, 2006, 09:40:46 pm
To publish a program, you can upload it to a web server or ftp server.

To prevent your program from closing (which is perfectly normal, by the way), you can for example wait for keyboard input. Look at the C/C++ new project template to learn how that is done (or look at a "learning C" tutorial.

Please do note that there are forums and collections of frequently asked questions dedicated to general C++ questions such as these (googling for C++ faq may help). We are a Code::Blocks forum.
Title: Re: making a working .exe than i can send to other people
Post by: sethjackson on February 06, 2006, 09:45:40 pm
To prevent your program from closing (which is perfectly normal, by the way), you can for example wait for keyboard input. Look at the C/C++ new project template to learn how that is done (or look at a "learning C" tutorial.

Maybe that should be a "learning C++" tutorial.  :lol:

Yeah I just told him how to wait for input. std::cin.get() :) Although it only waits for a carrige return IIRC.

Some tuts

http://www.cprogramming.com/tutorial/lesson1.html
http://cplusplus.com/doc/tutorial/

And a nice C\C++ reference (The STL reference helps me alot).

http://www.cppreference.com/index.html
Title: Re: making a working .exe than i can send to other people
Post by: seventhmoon on February 07, 2006, 09:00:12 am
Add this before return 0;

Code: cpp
std::cout << std::endl << "Press Enter to exit.";

std::cin.get();

Od.. Even after i added that it still does it.
Title: Re: making a working .exe than i can send to other people
Post by: sethjackson on February 07, 2006, 05:18:08 pm
Are you making a console program or a GUI program????

Post you full code here if you can please. :)
Title: Re: making a working .exe than i can send to other people
Post by: Vampyre_Dark on February 07, 2006, 07:23:12 pm
system("PAUSE"); will work too, but it's ugly.

Don't let that stop you from using it until you become more proficient in C++ though.