簡體   English   中英

包含導致預期功能主體錯誤的語句

[英]include statement casuing expected function body error

我在xcode中對C ++進行編碼,而以下代碼則導致“在函數delarator之后出現預期的函數體”錯誤:

#include <iostream>
#include <iomanip>
#include "Implementation.hpp"
using namespace std;

該錯誤在實現.hpp后彈出

這是我的Implementation.hpp文件:

    #ifndef Implementation_hpp
#define Implementation_hpp

using namespace std;



#include <stdio.h>

int* getLottoPicks(int picks[]);
int genWinNums();
bool noDuplicates(int picks[], int input)

#endif /* Implementation_hpp */

如果有人能找到問題,我將不勝感激! 提前致謝。

該編譯錯誤來自這里:

bool noDuplicates(int picks[], int input) // ';' or body expected

沒有; ,您的編譯器期望函數主體{ /* code */ }到來,而您沒有提供。

您有兩種選擇,其中一種是提供適當的函數體,如下所示:

bool noDuplicates(int picks[], int input)
{
    // Code
}

另一個聲明如下:

bool noDuplicates(int picks[], int input); // note that ';' is used.

暫無
暫無

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

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