I am using a solaris machine to run my c++ code
I have written the following code in the mentioned files
classclock.h
#include <iostream>
using namespace std;
class classclock
{
private:
int min;
int hour;
int sec;
//member function for the operations
public:
void SetTime(int a,int b,int c);
};
#include <iostream>
using namespace std;
#include "classclock.h"
void classclock::SetTime(int a,int b,int c)
{
if (0 < a && a < 24)
{
hour = a;
}
else {
hour = 0;
}
if (0 < b && a < 60)
{
min = b;
}
else {
min =0;
}
if (0 < c && c < 60)
{
sec = c;
}
else {
sec = 0;
}
}
test.cc
#include<iostream>
using namespace std;
#include "classclock.h"
int main(){
classclock myclock;
myclock.SetTime(10,10,10);
return 0;
}
I am not able to compile my test.cc and I am getting the following error:
Undefined first referenced
symbol in file
classclock::SetTime(int, int, int) /var/tmp//ccrMIpwv.o
ld: fatal: Symbol referencing errors. No output written to test
collect2: ld returned 1 exit status
please help!!!