ERROR: LNK 2019

Hello again. I am getting an LNK 2019 error to the following program. What am I doing wrong?:

#include <iomanip>
#include <iostream>
#include <fstream>
using namespace std;

const int ARRAY_SIZE = 100;
typedef char NameType[20];


void getList(int count, NameType delDate[ARRAY_SIZE], int zipCode[ARRAY_SIZE], int distance[ARRAY_SIZE], double cost[ARRAY_SIZE],
NameType custName[ARRAY_SIZE]);


int main()
{


NameType delDate[ARRAY_SIZE];
int zipCode[ARRAY_SIZE];
int distance[ARRAY_SIZE];
double cost[ARRAY_SIZE];
NameType custName[ARRAY_SIZE];

int count;

//Read file into Array
getList(count, delDate, zipCode, distance, cost,
custName);





system("pause");
return 0;
}



void getList(int count, NameType delDate[ARRAY_SIZE], int zipCode[ARRAY_SIZE], int distance[ARRAY_SIZE], double cost[ARRAY_SIZE],
NameType custName[ARRAY_SIZE])
{

ifstream inputFile;
ifstream inputFile2;

//Open the file
inputFile.open("shipment.txt");
inputFile2.open("zipMIcity.txt");


if (inputFile.fail())
{
cout << "ERROR: File not found" << endl;
cout << endl;
}

if (inputFile2.fail())
{
cout << "ERROR: File not found" << endl;
cout << endl;
}

//Read the numbers from the file into the array
while (count < ARRAY_SIZE && inputFile >> delDate[count] >> zipCode[count] >> distance[count] >> cost[count] >> custName[count])
count++;

for (count = 0; count < ARRAY_SIZE; count++)
{
inputFile >> delDate[count] >> zipCode[count] >> distance[count] >> cost[count] >> custName[count];
}


//Close the file
inputFile.close();
inputFile2.close();

}

***THIS IS WHAT THE ERROR READS***
Error 2 error LNK2019: unresolved external symbol "void __cdecl getList(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * const,int * const,int * const,double * const,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * const)" (?getList@@YAXHQAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAH1QAN0@Z) referenced in function _main
It compilescompiles and links for me (VS2010).

I don't know why, but try including #include <string> .

Or maybe don't define ARRAY_SIZE in the declaration and definition of getList like so:
void getList(int count, NameType delDate[], int zipCode[], int distance[], double cost[], NameType custName[]);

Which compiler are you using?
Last edited on
It looks like a compiler bug.
A LNKXXXX error is a linker error in visual studio.
Im using Microsoft Visual C++ 2010 Express. Im about to remove ARRAY_SIZE and see if that works.
Yes! It worked. Thanks alot Stewbond.
Topic archived. No new replies allowed.