我们可以在eclipse中运行多个C源文件吗? [英] Can we run multiple C source files in eclipse?

查看:118
本文介绍了我们可以在eclipse中运行多个C源文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

致所有IT大师,



亲爱的代码项目成员,



我正在尝试执行Eclipse中一个项目中的.C文件。我收到错误。所以,例如,让我们说我有下面的代码。



文件1和2都在同一个项目First C Project中,这是允许的。??



项目名称 - First_C_Project





文件1 = Example.C



#include< stdio.h>

#include< stdlib.h>

#include< conio.h>



int main(无效){





printf(C编程,这是我的第一个C程序);



返回EXIT_SUCCESS;

}





文件2:TestProgram.C





#include< stdio.h>

#include< stdlib.h>

#include< conio.h>



int main(void){





printf(这是测试C程序,请查看。);



返回0;

}



我尝试过:



我用File 2 C创建了一个新项目文件中。这很有效。但为什么我不能把2 C文件放在同一个First_C_Project项目中?

解决方案

简答:

你可以跨越许多C文件的C项目,但项目中只能有1 main 函数。



< blockquote class =quote>

引用:

为什么会这样?目的是什么?

为什么天空是蓝色的?



以下是语言作者对C和C ++参考书的链接。注意,C是C ++的祖先,所以知道C对C ++总是有用。

C编程语言 - 维基百科,免费的百科全书 [ ^ ]

https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2。 pdf [ ^ ]

http://www.ime.usp。 br / ~pf / Kernighan-Ritchie / C-Programming-Ebook.pdf [ ^ ]



C ++编程语言 [ ^ ]


使用C和C ++, main()函数是程序的入口点(另请参阅入口点 - 维基百科 [ ^ ]和主要功能 - cppreference.com [ ^ ])。



入口点是执行创建的程序时调用的函数。很明显,每个程序只能有一个实现。


To All IT Gurus,

Dear Code Project members,

I am trying to execute 2 .C files in one project in Eclipse. I get error. So, for example, Let us say I have this below code.

Both files 1 and 2 are in the same project First C Project, Is this allowed.??

Project Name - First_C_Project


File 1 = Example.C

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main(void) {


printf ("C Programming, This is my First C Program");

return EXIT_SUCCESS;
}


File 2: TestProgram.C


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main(void) {


printf ("This is a TEST C Program, Check it out. ");

return 0;
}

What I have tried:

I created a new project with a File 2 C file. And that works. But why can't I put the 2 C files work within the same First_C_Project project ???

解决方案

Short answer:
You can span a C project across many C files but you can only have 1 main function in the project.

Quote:

Why is that? What is the purpose?

Why the sky is blue ?

Here is links to references books on C and C++ by the authors of the languages. Note than C is the ancestor of C++, so knowing C is always useful with C++.
The C Programming Language - Wikipedia, the free encyclopedia[^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[^]

C++ Programing Language[^]


With C and C++, the main() function is the entry point of a program (see also Entry point - Wikipedia[^] and Main function - cppreference.com[^] ).

The entry point is the function that is called when the created program is executed. So it is obvious that there can be only one implementation per program.


这篇关于我们可以在eclipse中运行多个C源文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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