非常简单的cygwin / gcc问题 [英] Really easy cygwin / gcc question

查看:95
本文介绍了非常简单的cygwin / gcc问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


为什么当我订购并运行以下内容时:


#include" stdio.h"

main(无效)

{

printf(" test test test\ n);;

}


我没有输出到屏幕?如果我在ddd调试器中运行它,我会在控制台窗口中得到

''测试测试'',但是当我从Xterm运行它时,

没有。我想知道stdout是否设置在其他地方,但我如何检查

这个?


问候

Michael

Hi All,

Why when I complile and run the following:

#include "stdio.h"
main(void)
{
printf("test test test\n");
}

do I get no output to the screen? If I run it in the ddd debugger I get the
''test test test'' in the console window, but when I run it from an Xterm get
nothing. Im wondering if stdout is set to somewhere else, but how do I check
this?

Regards
Michael

推荐答案



Michael写道:

Michael wrote:
大家好,

为何何时何时我恭维并运行以下内容:

#include" stdio.h"
main(void)
{/ / printf(" test test test \ n) ;);
}

我没有输出到屏幕?如果我在ddd调试器中运行它,我会在控制台窗口中得到
''测试测试',但是当我从Xterm运行它时什么也没有。我想知道stdout是否设置在其他地方,但我如何检查
这个?
Hi All,

Why when I complile and run the following:

#include "stdio.h"
main(void)
{
printf("test test test\n");
}

do I get no output to the screen? If I run it in the ddd debugger I get the
''test test test'' in the console window, but when I run it from an Xterm get
nothing. Im wondering if stdout is set to somewhere else, but how do I check
this?




您的程序应输出test test test如你所料。唯一的问题是你需要从C $ C
`main()`返回一些内容。你不知道你传给你的编译器的选项和

你得到了什么警告。



Your program should output "test test test" as you expect. The only
problem you have is that pre-C99 you need to return something from
`main()`. You don''t tell what options you passed to your compiler and
what warnings, if any, you get.




弗拉基米尔奥卡写道:

Vladimir Oka wrote:
迈克尔写道:
大家好,

为什么当我压缩并运行以下内容时:

#include" stdio.h"
main(void)
{
printf(" test test test \ n);
}

我没有输出到屏幕?如果我在ddd调试器中运行它,我会在控制台窗口中得到
''测试测试',但是当我从Xterm运行它时什么也没有。我想知道stdout是否设置在其他地方,但是我如何检查这个?
Hi All,

Why when I complile and run the following:

#include "stdio.h"
main(void)
{
printf("test test test\n");
}

do I get no output to the screen? If I run it in the ddd debugger I get the
''test test test'' in the console window, but when I run it from an Xterm get
nothing. Im wondering if stdout is set to somewhere else, but how do I check
this?



你的程序应该输出test test test。如你所料。你唯一的问题是,在C99之前你需要从
`main()`返回一些东西。你不知道你传给你的编译器的选项是什么,以及
你得到了什么警告。



Your program should output "test test test" as you expect. The only
problem you have is that pre-C99 you need to return something from
`main()`. You don''t tell what options you passed to your compiler and
what warnings, if any, you get.




PS

在声明`main()`时你也应该避免使用隐式`int`。拼写

out:


int main(无效)



PS
You should also avoid implicit `int` when declaring `main()`. Spell it
out:

int main(void)


Hi Vladimir ,


我刚用过:

gcc -g test.c -o test.exe


我得到的没有警告或错误


感谢您的帮助。


问候

Michael

Vladimir Oka <无**** @ btopenworld.com>在消息中写道

news:11 ********************** @ i40g2000cwc.googlegr oups.com ...
Hi Vladimir,

I just used:
gcc -g test.c -o test.exe

I get no warnings or errors

Thanks for your help.

Regards
Michael
"Vladimir Oka" <no****@btopenworld.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...

迈克尔写道:

Michael wrote:
大家好,

为什么当我恭维并运行以下内容时:

#include" ; stdio.h"
main(无效)
{
printf(" test test test\ n));
}

我是没有输出到屏幕?如果我在ddd调试器中运行它,我会在控制台窗口中得到
''测试测试'',但是当我从Xterm运行它时,什么都没有。我想知道stdout是否设置在其他地方,但我该如何检查
这个?
Hi All,

Why when I complile and run the following:

#include "stdio.h"
main(void)
{
printf("test test test\n");
}

do I get no output to the screen? If I run it in the ddd debugger I get
the
''test test test'' in the console window, but when I run it from an Xterm
get
nothing. Im wondering if stdout is set to somewhere else, but how do I
check
this?



你的程序应该输出test test test。如你所料。你唯一的问题是,在C99之前你需要从
`main()`返回一些东西。你不知道你传给你的编译器的选项是什么,以及
你得到了什么警告。



Your program should output "test test test" as you expect. The only
problem you have is that pre-C99 you need to return something from
`main()`. You don''t tell what options you passed to your compiler and
what warnings, if any, you get.



这篇关于非常简单的cygwin / gcc问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆