如何在Eclipse Indigo中编译C源代码? [英] How to compile C source in Eclipse Indigo?

查看:104
本文介绍了如何在Eclipse Indigo中编译C源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使是最简单的源代码,我也无法编译C源代码.
以下是我已采取的步骤:我已经在Windows XP 32位上下载了eclipse-cpp-indigo-SR1-incubation-win32,并安装了mingw-get-inst-20110530.exe.我在Windows路径中设置了C:\ MinGW \ bin.
尝试包含

I have not been abled to compiled a C source, even the simplest one.
Following are the steps I have taken: I''ve downloaded eclipse-cpp-indigo-SR1-incubation-win32 and installed mingw-get-inst-20110530.exe on my Windows XP 32 bits. I have setted the C:\MinGW\bin in Windows Path.
I am getting this error while trying to include

stdio.h

:
时出现此错误

:

Multiple markers at this line
    - Unresolved inclusion: <stdio.h>
    - fatal error: stdio.h: No such file or
     directory


我是否必须在


Do I have to include something in

Properties, C/C++ Build, Settings, MinGW C++ Linker

中包含一些内容?我没有在库中写任何东西.

? I didn''t wrote anything in Libraries.

推荐答案

包含目录"应该有一些设置.此设置将通知编译器,例如stdio.h的文件位于何处.尝试浏览所有设置,看看是否可以找到一个名为包含目录"的文件.
There should be some setting for "Include Directories". This setting will inform the compiler where files like stdio.h are located. Try looking through all of the Settings and see if you can find one called Include Directories.


我的包含"用
C:\MinGW\include

填充,而我的图书馆"用

and my Libraries with

"C:\MinGW\lib"

填充.我猜这已经足够了.但是,当我尝试使用

. I am guessing that this is enought. But I am still getting the same message when I try to use

stdio.h

时,我仍然收到相同的消息,但是如果仅使用stm.h,则不会得到任何错误提示.我确定我会丢失一些细节,但我不知道该怎么办.我可以在

but I am getting no erros if I only use stm.h. I am sure I am losing some detail but I don''t know what. Shall I include some library in

C/C++ Build>>Sttings>>GCC C++ Compiler >>Includes

中包含一些库吗?我知道这是没有必要的,因为MingW已经包含GCC.如果我错了,我还必须包括什么?

? I am ingaing that it''s not necessary because MingW already contain GCC. If I am wrong, whatelse I must include in?


您是否可以使用gcc或g ++从命令行编译一些代码?

写一个简单的文件:

Are you able to compile some code from the command line with gcc or g++ ?

Write a simple file :

#include <stdio.h>

int main()
{
 return 0;
}
</stdio.h>



将文件另存为"test.c"
(据我所知,未经测试,这应该可以工作)
并在命令行中:



save file as "test.c"
(not tested, as far as I remember, this should work)
and from the command line :

gcc text.c



那是什么输出?



What is the output of that ?


这篇关于如何在Eclipse Indigo中编译C源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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