开发者

expecting initial declarator before functions when i put header file in [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making th开发者_如何学Gois question more broadly applicable, visit the help center. Closed 9 years ago.

For some reason when I put my header file in I get this error: expected init-declarator before "int" (or void)

main:

#include "header.h"


int main()
{
    char gender;
    float gpa;
    ifstream inData;
    ofstream outData;


    inData.open("./Ch7_Ex4Data.txt");
    outData.open("./Ch7_Ex4Dataout.txt");

    inData >> gender >> gpa;
    outData << gender << gpa << endl;


    inData.close();
    outData.close();

    system("PAUSE");
    return EXIT_SUCCESS;
}

other function:

#include "header.h"

void initialize (int& countFemale, int& countMale, float& sumFemaleGPA, float& sumMaleGPA)
{
            countFemale = 0;
            countMale = 0;
            sumFemaleGPA = 0;
            sumMaleGPA = 0;
}

header:

#ifndef header_h
#define header_h

#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstring>
#include <cstdlib>

using namespace std;

void extern initialize(int&, int&, float&, float&)


#endif


Missing semicolon in your declaration of initialize.

void extern initialize(int&, int&, float&, float&);  // <---- here
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜