I'm having a slight issue. My program is supposed to read data from a text file, put that data into an array of structs, and then output the data to a different text file, among other things.
This issue I'm having is that whenever I go to compile, I get the following error:
undefined reference to 'printData(std::basic_ofstream<char, std::char_traits<char> >&, CDdata*, int)'
Now, I understand what an "undefined reference" error is, however I (as well as a peer) have double and triple checked this and can't find where I screwed up. The error is referring to the printData() line in main(). I don't get how there's an error there, but getData() gave me no errors, and an earlier version of this program (without printData()) compiled just fine. 
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
struct CDdata
{
  string title;
  float cost;
  int inventory;
};
void getData(ifstream& in, CDdata cdarray[], int& num);
void printData(ofstream& out, CDdata cdarray[], int num);
int main(int argc, char** argv){ //MAIN STARTS HERE
  ofstream outputFile;
  ifstream inputFile; // this and the line above it delcare the file objects
  CDdata cdarray[8]; //this creates the array of structs, as CDdata is the type
  inputFile.open("CDin.txt");// this and the line below open the in n out files
  outputFile.open("CDout.txt");
  int num = 0; //establishes num for use in getdata and printData
  int sum = 0; //establishes calcTotal for use below
  getData(inputFile, cdarray, num); //this establishes the getData command
  printData(outputFile, cdarray, num); //this establishes printdata and what can be used
  inputFile.close();
  outputFile.close();
  return 0;
}//end of main
//GET DATA STUFF
void getData(ifstream& in, CDdata cdarray[], int& num)//start of getdata function
{
  in >> num; //this reads the first line of the input file, which is 6 in our
            //case. this assigns it to num, with num being the amount of times
            //the below for loop will run for
  for(int k = 0; k<=num; k++)//this establishes k and the for loop
  {
    in >> cdarray[k].title;
    in >> cdarray[k].cost;
    in >> cdarray[k].inventory; //this and the above two lines read the data
                                //from the file and input it into the  array
  }
}//LAST BRACKET FOR GETDATA
//PRINT DATA STUFF
void printData(ofstream& out, CDdata cdarray[], int& num)//start of printData function
{
  out << "The following is the data from the structs:" << endl;
  for(int j = 0; j < num; j++)
  {
    out << cdarray[j].title;
    out << cdarray[j].cost;
    out << cdarray[j].inventory; //These three print just like the get one reads in
  }
}//LAST BRACKET FOR PRINT STUFF
int calcTotal(ofstream& out, CDdata cdarray[], int& num, int& sum) //establishes calcTotal function
{
  out << "This is the amount of CDs in inventory: " << endl;
  for(int h = 0; h<=num; h++)
  {                 //this loop calculates the sum of total CDs in inventory
    sum = sum + cdarray[h].inventory;
  }
  out << sum;
} //end calcTotal
int findbelow5(ofstream& out, CDdata cdarray[], int& num)
{
  out << "These are the names of the CDs with less than 5 copies in the inventory " << endl;
  for(int g = 0; g<=num; g++)
  {
    if(cdarray[g].inventory < 5)
      out << cdarray[g].title;
  }
}//end of findbelow5
 
     
    