我有一個函數,我想從類方法內調用。該函數位於名爲mergeSort.cpp的文件中。下面是這個類中實現的.cpp文件的一個片段:從類方法調用「外部」函數
// other includes
#include "mergeSort.cpp"
// other methods
void Servers::sortSites() {
mergeSort(server_sites.begin(), server_sites.end(), siteCompare);
}
// remaining methods
當我嘗試編譯我得到的錯誤說,歸併無法找到。我認爲這是因爲它試圖調用Servers :: mergeSort。我將如何去調用一個外部函數?