468,738 Members | 1,790 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,738 developers. It's quick & easy.

compiling quistion

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 se the lightat the end, but every time I take a step it's get dim.
Nov 14 '05 #1
11 1264
In article <opslfphvp75plaj0@big>, Carramba <no****@privet.net> 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 call BINGO!

Nov 14 '05 #2
On Sun, 30 Jan 2005 21:23:06 GMT, Kenny McCormack
<ga*****@yin.interaccess.com> wrote:
In article <opslfphvp75plaj0@big>, Carramba <no****@privet.net> 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 call BINGO!

and what exactly it suppose to mean?
--
______________________________________
I se the lightat the end, but every time I take a step it's get dim.
Nov 14 '05 #3
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?

--

----- BEGIN GEEK CODE BLOCK -----
Version 3.1
GAT d? !s !a C++++ UL+ P L++ E- W+ N+ o-- K- w--
O- !M !V PS-- PE++ Y+ PGP- t++>++++* 5? !X-- R- tv b++ DI+ D++
G e !h !r !y
...... END GEEK CODE BLOCK ----
Nov 14 '05 #4
Just to translate that:

If you open the command prompt (the thing that looks like DOS) and run
the application from that then the application will write "Hello
world!"
Windows by itself doesn't have anywhere to show it, so you need to do
it in the command prompt.

-Chris

Nov 14 '05 #5
Chris Williams wrote:
Just to translate that:


Saying obfuscated was I, were you, eh?

--

----- BEGIN GEEK CODE BLOCK -----
Version 3.1
GAT d? !s !a C++++ UL+ P L++ E- W+ N+ o-- K- w--
O- !M !V PS-- PE++ Y+ PGP- t++>++++* 5? !X-- R- tv b++ DI+ D++
G e !h !r !y
...... END GEEK CODE BLOCK ----
Nov 14 '05 #6
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?


<ot>
Let me guess. Double-clicking the executable opens a
command window, executes the program before you can see the output,
and vanishes? Learn to use the command-line instead of that
point-n-click thing.

However, here is one solution to the problem:
------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\exefile\shell\runcmd]
@="Run in Console"

[HKEY_CLASSES_ROOT\exefile\shell\runcmd\command]
@="cmd /k \"echo Executing (Press Ctrl+C to end
program)...&&\"%L\"&&pause&&exit\""

[HKEY_CLASSES_ROOT\batfile\shell\runcmd]
@="Run in Console"

[HKEY_CLASSES_ROOT\batfile\shell\runcmd\command]
@="cmd /k \"echo Executing batch script...&&\"%L\"&&pause&&exit\""
------

Put the lines between the ------ markers in a file
called run_in_console.reg and double-click it.
Click Yes to merge it with your registry.
(If it didn't work, add these entries manually using regedit;
and these are for XP only.)

This will enable a new menu command when you right-click on
exe files. Use it.
</ot>

Regards,
Jonathan.

--
"We must do something. This is something. Therefore, we must do this."
- Keith Thompson
Nov 14 '05 #7
If you were what you say I implied your statement was then that
wouldn't make sense.

-Chris

Nov 14 '05 #8
"Chris Williams" <th********@yahoo.co.jp> wrote:
If you were what you say I implied your statement was then that
wouldn't make sense.


Without any context, _nothing_ makes sense. If you _must_ use Google-
broken-beta, learn to use it properly.

Richard
Nov 14 '05 #9
Chris Williams wrote:
If you were what you say I implied your statement was then that
wouldn't make sense.

-Chris


Gimme a minute....was I insulted just now?

--

----- BEGIN GEEK CODE BLOCK -----
Version 3.1
GAT d? !s !a C++++ UL+ P L++ E- W+ N+ o-- K- w--
O- !M !V PS-- PE++ Y+ PGP- t++>++++* 5? !X-- R- tv b++ DI+ D++
G e !h !r !y
...... END GEEK CODE BLOCK ----
Nov 14 '05 #10
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:Th*************@gmail.com>
Nov 14 '05 #11
In article <opslfqohp45plaj0@big>, Carramba <no****@privet.net> wrote:
On Sun, 30 Jan 2005 21:23:06 GMT, Kenny McCormack
<ga*****@yin.interaccess.com> wrote:
In article <opslfphvp75plaj0@big>, Carramba <no****@privet.net> 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 call BINGO!

and what exactly it suppose to mean?


The instant you mention things like either "winXP" or "msvisual c++"
you invoke the fury of the topicality police.

You might want to google for "breeder bingo"...

Nov 14 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rudy Ray Moore | last post: by
1 post views Thread by Jim Heavey | last post: by
10 posts views Thread by Christina N | last post: by
2 posts views Thread by Justin Naidl | last post: by
reply views Thread by =?Utf-8?B?amVmZmVyeQ==?= | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.