简体   繁体   中英

include statement casuing expected function body error

Im coding C++ in xcode and the following code is causing an "expected function body after after function delarator" error:

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

the error is popping up after implementation.hpp

here is my implementation.hpp file:

    #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 */

if anyone could find the issue i would greatly appreciate it! Thanks in advance.

That compile error comes from here:

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

Without ; , your compiler expects a function body { /* code */ } to come, which you do not provide.

You have two options, one of which is to provide a proper function body as follows:

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

the other of which is to declare as follows:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM