Sunday, 18 August 2013

Undefined reference function issues

Undefined reference function issues

I am new at C++ programming. Please can some one look at my code and
advise what I am doing wrong. I am reading in a text file with various
int, string and double fields which are tab delimited. I am trying to
produce an array of positions of the '/t' characters. I am at my wits end
trying to get this to work. I keep getting
undefined reference to getTAB(std::string, int*)
error in main.
What am I doing wrong?
My files are as follows
main.cpp
#include <iostream>
#include <fstream>
#include <string>
#include "getTAB.h"
using namespace std;
int main (){ int tab = 7; int tabPosition[tab];
string lineOfInput;
ifstream inFile("DATA/inputData.txt");
while(getline(inFile,lineOfInput)){
cout << lineOfInput << endl;
getTAB(lineOfInput, &tabPosition[0]); } inFile.close(); return 0; }
getTAB.h
#ifndef GETTAB_H_INCLUDED
#define GETTAB_H_INCLUDED
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void getTAB(string line, int *array);

No comments:

Post a Comment