0

I am new to C++ and have just created a separate class file in my program. There are three files, main.cpp, Cal.h, and Cal.cpp. When I create an object of Cal in the main.cpp file, I get this error: undefined reference to Cal::Cal()

Im quite puzzled by this. Any help will be apreciated. Thanks.

Here is the source files: main.cpp:

#include <iostream>
#include "Cal.h";

using namespace std;

Cal c;

int main()
{


return 0;
}

Cal.h:

#ifndef CAL_H
#define CAL_H


class Cal
{
    public:
    Cal();
    int add(int a, int b);
    int sub(int a, int b);
    int mul(int a, int b);
    int div(int a, int b);
};

#endif // CAL_H

Cal.cpp:

#include "Cal.h"
#include <iostream>

using namespace std;

Cal::Cal()
{

}


int Cal::add(int a, int b){


return 0;
}

int Cal::sub(int a, int b){
return 0;
}

int Cal::mul(int a, int b){
return 0;
}

int Cal::div(int a, int b){
return 0;
}
Sock314
  • 157
  • 9

0 Answers0