Publish a win32 console app?

Hey folks, this should be my last question of..well of the immidiate future anyway. I finished this nifty little game, and I'd like to email it to some friends as a .exe. Except I have no idea how to do it.

I've been trying to find as much information myself as I can, but I've had to ask alot of questions to this community anyway. And again now...I tried looking up how to do this, but I havn't really seen any adequite explanations. I read something about something about something called ClickOnce, but no real good explanation of what that is, how to use it, or if its even what I want.

Does anyone know what I'm talking about?
1) Compile program (preferably a "Release" build)
2) Get .exe file out of project directory
3) ???
4) Profit!
Do I have to do something special to make it a release build?

If not I know exactly what you're talking about, the .exe in the Debug folder (Right?), except that opens a whole new can of worms because even with Duoas's magic tricks for doing a pause without using system();, it wont stay open.

[EDIT] Nevermind figured out that I have to swap the build setting from debug to release, except the .exe still doesn't stay open. Even with

1
2
3
4
int c;
printf( "Press ENTER to continue..." );
fflush( stdout );
do c = getchar(); while ((c != '\n') && (c != EOF));


And I pulled that right off an article in this website...[/EDIT]
Last edited on
Works just fine with system("pause") but the c++ monster will come and eat me in my sleep if I leave it in my program :-p
If not I know exactly what you're talking about, the .exe in the Debug folder (Right?)


Well if you did a Release build, it would be in the Release folder. Debug builds are unoptimized and export a lot of symbols (ie: they're big and slow -- not ideal for distribution)

Re the 'closing right away' problem... welcome to console. It's supposed to close unless you open a command prompt.

getchar() has worked for me in the past.. no need to check the return, at least I never have to. But I don't generally compile console programs though -- and when I do it's just for quick tests and I don't run them outside of the debugger, so I might be wrong.

1
2
cout << "Press ENTER to continue...";  // or printf(), whatever
getchar();  // works for me 


If that doesn't work I can't help you. I'll let someone more familiar with console nonsense step in.
How many more times will this be linked to?
http://www.cplusplus.com/forum/beginner/1988/
Nope...Just tried it, and I've already tried every other approach I could find on this site. All of them technically work while executing from the IDE, but I don't need it there. And when running it as just a .exe, nothing but system("pause") works. But thats no good...
helios, are you referring to the one at the top? or anything else found in http://www.cplusplus.com/forum/articles/7312/ ? Because I've tried all that I could and none work.

1
2
3
4
5
6
7
8
#include <iostream>
#include <limits>

void PressEnterToContinue()
  {
  std::cout << "Press ENTER to continue... " << flush;
  std::cin.ignore( std::numeric_limits <std::streamsize> ::max(), '\n' );
  }
this one didn't even compile, I got oodles of errors (and yes, I #included <limits>) I remember one of them being about max not having enough parameters, but there were more than that.

I have yet to try the OS specific goodies though.
put this in a text file:
1
2
name_of_your_program.exe
pause


save it as "run.bat", keep it with your exe. Run that instead of your exe.

EDIT:

this one didn't even compile, I got oodles of errors (and yes, I #included <limits>) I remember one of them being about max not having enough parameters, but there were more than that.


This is because <windows.h> #defines min and max.. effectively screwing the standard lib

#undef them immediately after you include it:

1
2
3
#include <windows.h>
#undef min
#undef max 
Last edited on
Topic archived. No new replies allowed.