User forums > Using Code::Blocks

making a working .exe than i can send to other people

(1/2) > >>

seventhmoon:
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.

sethjackson:
Add this before return 0;


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

std::cin.get();

--- End code ---

thomas:
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.

sethjackson:

--- Quote from: thomas on February 06, 2006, 09:40:46 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.

--- End quote ---

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

seventhmoon:

--- Quote from: 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();

--- End code ---

--- End quote ---

Od.. Even after i added that it still does it.

Navigation

[0] Message Index

[#] Next page

Go to full version