When I try to compile my implementation file using g++ -c Sorting_Functions.cpp
, I get this message
error: use of undeclared identifier 'IntSort'
IntSort.h
#ifndef INTSORT_H_
#define INTSORT_H_
#include "Sorting_Functions.cpp"
class IntSort
{
public:
IntSort();
void print();
private:
int arr[5];
int len;
};
#endif
Sorting_Functions.cpp
#include "IntSort.h"
using namespace std;
IntSort::IntSort()
{
arr[0] = 7;
arr[1] = 3;
arr[2] = 2;
arr[3] = 6;
arr[4] = 4;
len = 5;
}
// prints the lists to the user
void IntSort::print()
{
cout << "{ ";
for (int i = 0; i < len; i++) {
cout << arr[i] << " ";
}
cout << "}";
}