Re: compiling quistion
From: Kenneth Brody (kenbrody_at_spamcop.net)
Date: 02/01/05
- Next message: Malcolm: "Re: what is size_t"
- Previous message: Marcin: "Division with arrays?"
- Maybe in reply to: Richard Bos: "Re: compiling quistion"
- Next in thread: Kenny McCormack: "Re: compiling quistion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 01 Feb 2005 16:26:20 -0500
Jacob Oost wrote:
>
> Carramba wrote:
> > hi!
> > thanx for taking time to read my post.
> > code
> > #include <stdio.h>
> > int main() {
> > printf("Hello word!");
> > return 0;
> > }//END
> >
> > when Iam compiling code with gcc I can't start program in winXP by
> > doubleclicking it, but if I do it with msvisual c++ I can
> > Why is that, and how to configure the compiler to work properly?
>
> I thought under Windows GCC was called something else, like DJPP or
> EGCS. Anyway, I believe this is because XP has really, really, really
> crappy backwards support, like for old DOS programs (even worse legacy
> support than 95/98 did). XP sees a program that calls the printf()
> function and says, "Oh, a DOS program, I'll just sit here and do nothing
> while he double-clicks like mad." You would have to open a DOS shell
> and enter the prog.exe command or fiddle with the properties somehow
> (forget exactly how, let's just say that getting DOS games, even ones as
> recent as 1995, to run on XP is a chore) to run your little Hello World
> in a DOS shell automatically. Visual Studio, OTOH, has a built-in DOS
> shell, because they know that plenty of people (students, for instance)
> will be writing programs to learn on that only use the standard
> libraries and no WIN32 stuff.
>
> Isn't XP grand?
What version of XP are you using that does that? None of the versions I
have come anywhere close to your description.
This is getting off-topic for c.l.c, but the "problem" is that the program
starts, runs, and exits faster than the OP can see it. Yes, XP created a
console window automatically when the icon was double-clicked. There is
nothing special about running under Visual Studio, aside from the fact
that it will put a "press any key to continue" prompt for you when you do
so.
Try this (untested) modification:
#include <stdio.h>
int main() {
printf("Hello word!");
printf("\n\nPress Enter to continue.\n");
fflush(stdout);
while ( getchar() != '\n' )
;
return 0;
}//END
Or, for a Windows-specific "solution", change the properties of the icon
to not close upon exit.
-- +-------------------------+--------------------+-----------------------------+ | Kenneth J. Brody | www.hvcomputer.com | | | kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> | +-------------------------+--------------------+-----------------------------+ Don't e-mail me at: <mailto:ThisIsASpamTrap@gmail.com>
- Next message: Malcolm: "Re: what is size_t"
- Previous message: Marcin: "Division with arrays?"
- Maybe in reply to: Richard Bos: "Re: compiling quistion"
- Next in thread: Kenny McCormack: "Re: compiling quistion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|