简体   繁体   中英

Passing 2D array into function

I'd like to pass my 2D Array of class Menza into function..

class Menza
{
    public:
    string PrintLunch() const {return Lunch;};
    unsigned int PrintID() const {return ID;};
    double PrintPrice() const {return Price;};
    double PrinteValue() const {return eValue;};
    string PrintDescription() const {return Description;};
    void ChangeLunch(string Change) {Lunch = Change;};
    void ChangePrice(double Change) {Price = Change;};
    void ChangeID(int Change) {ID = Change;};
    void ChangeeValue(double Change) {eValue = Change;};
    void ChangeDescription(string Change) {Description = Change;};
private:
    string Lunch;
    double Price;
    unsigned int ID;
    string Description;
    double eValue;
};

const int Lunches = 5;

void LoadFile(bool FileChoice,Menza (*InputFromFile)[Lunches]);
void CustomerSelection(Menza CustomerSelect[],Menza (*InputFromFile)[Lunches]);

int main()
{
    Menza InputFromFile[Lunches][Lunches];
    Menza CustomerSelect[Lunches];
    bool FileChoice = false;

    LoadFile(FileChoice,InputFromFile);
    CustomerSelection(CustomerSelect,InputFromFile);
}

Once I compile this, it shows me:

Semestralka.obj : error LNK2019: unresolved external symbol "void __cdecl LoadFile(bool,class Menza (*)[5])" (?LoadFile@@YAX_NPAY04VMenza@@@Z) referenced in function _main
1>E:\My VSB\ZP projekty\Semestralka\Debug\Semestralka.exe : fatal error LNK1120: 1 unresolved externals

Can someone explain me whats wrong in this function call?

Thanks

You don't have definition of LoadFile function, only declaration. Therefore compiler have no way to understand what this function should do. You must define it or link a library where it is defined (and include a header from this library). (Same is true for CustomerSelection too).

Read more about difference between definition and declaration here: declare_vs_define

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