1._how如何在单独的文件中创建C ++函数并将其添加到头文件(.h),然后将头文件添加到主程序文件中。 [英] 1._how to create a C++ function in a separate file and add it to a header file(.h), then add the header file to the main program file.

查看:285
本文介绍了1._how如何在单独的文件中创建C ++函数并将其添加到头文件(.h),然后将头文件添加到主程序文件中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助解决这个问题,我的作业将于今天下午2点结束。

Please help with this problem , my homework is due today at 2pm.

推荐答案

根据您所在的时区,您可能已经迟到了。

Depending on you time zone, you may already be late.

您可以使用添加新文件功能将cpp文件添加到项目中并创建文件。 然后编辑文件以定义您的函数。

You use the add new file function to add the cpp file to your project and to create the file.  Then you edit the file to define your function.

您编辑头文件以仅添加该函数的原型。

You edit the header file to add ONLY a prototype for the function.

您添加标题使用#include预处理程序指令将文件归档到主程序文件。

You add the header file to the main program file using the #include preprocessor directive.


这篇关于1._how如何在单独的文件中创建C ++函数并将其添加到头文件(.h),然后将头文件添加到主程序文件中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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