main()函数位于哪里?我们可以在头文件之类的编译器文件中看到其定义吗? [英] where is the main() function located ? can we see its definition in the compiler files like header files?

查看:281
本文介绍了main()函数位于哪里?我们可以在头文件之类的编译器文件中看到其定义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

main()函数位于哪里?我们可以在诸如头文件之类的编译器文件中看到其定义吗?

where is the main() function located ? can we see its definition in the compiler files like header files?

推荐答案

转到 ^ ],并花一些时间学习该语言的基础知识.这将比在这里发布单个问题更快(更好).
Go to Bjarne Stroustrup''s homepage[^] and spend some time learning the basics of the language. It will be faster (and better) than posting individual questions here.


您的主要功能将位于已编译文件中.我会费力地猜测您正在使用某种框架(MFC,Qt等),该框架将实际的main()函数入口点隐藏到了程序中.如果这是您要的内容,是的,它位于框架随附文件中的某个位置,如果看不到它,通常是因为您不应该拥有在大多数情况下覆盖它.您不想覆盖其实现的原因...是因为它们在主体中执行了使框架正确运行的特定操作,因此,除非您真的知道自己在做什么,否则请不要更改它.
You main function WILL be somewhere within your compiled files. I''m going to go out on a limb and guess that you''re using some sort of framework (MFC, Qt, etc.) that''s hiding the actual main() function entry point into your program. If that''s what you''re asking, yes, it''s somewhere in the files that are included with the framework and if you can''t see it, it''s usually because you shouldn''t have to override it in most cases. The reason you don''t want to override their implementation... because they do specific things within the main that make the framework work correctly, so don''t change it unless you really know what you''re doing.


以下任何一种原型都可以很好地使用:
int main(int,char [] *)
int main()
void main()
无需声明.在程序的启动可执行代码中,是对该函数的调用.您只需要实现它即可.
Any of these prototypes are good to use:
int main(int,char[]*)
int main()
void main()
It is no need to declare it. In the startup executable code of the program is a call to this function. You only have to implement it.


这篇关于main()函数位于哪里?我们可以在头文件之类的编译器文件中看到其定义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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