簡體   English   中英

如何在 main 中調用另一個 CPP 文件中的所有其他函數

[英]How do I call all the other functions in main which are in another CPP file

我已經創建了一個.CPP 文件(它也有 main() 並且所有函數都被調用)和 ah 文件(所有函數都寫在一個類中)。我不知道如何將它們鏈接在一起。

*include"yourfilename.h" 您的 main.cpp 文件 也將此包含寫入您已實現 class 功能的 other.cpp 文件中。

帶有 header 文件的程序的簡單文件結構應該是這樣的:

文件名.h

/*
Your Function Declarations
*/

文件名.cpp

 #include"filename.h"
 /* -Functions Declared in filename.h would be implemented here
  Your Function Implementations
 */

主文件

#include"filename.h"

int main(){

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM