I'm making a basic C++ setup. There is a main file, which calls a function, quickSort from another file, qSort.h/qSort.cpp. However, when I try to do so I get unresolved external symbol, which means that the function prototype is visible, but not the function definition itself. However, when I move the quickSort function into the header, then it runs just fine, so it must be a problem recognizing the function definition.
The qSort header looks like:
#ifndef __qSort_h__
#define __qSort_h__
int quickSort(int * inputArray);
#endif
The qSort source looks like(empty for now as I fix this):
#include "qSort.h"
int quickSort(int * inputArray){
return 4;
}
And it is called simply in my main file as:
std::cout << quickSort(arrayInput);
and included in the main source file with:
#include "qSort.h"
#include "SortingPractice.h"
#define ARRAY_LENGTH 20
I've been told that placing any actual code in your header is terrible, so I'm looking for some advice how to do avoid doing so while getting this code to run. Thank you.