i'm trying to read a file into an array struct using a function, i get the errors:
1.error LNK2019: unresolved external symbol "void __cdecl loadarray(struct ElementType * const,int)" (?loadarray@@YAXQAUElementType@@H@Z) referenced in function _main
2.fatal error LNK1120: 1 unresolved externals
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
ifstream fin;
int i =0;
struct ElementType
{
string Name;
int atomicnumber;
double atomicmass;
double density;
}r1,r2,r3;
void loadarray(ElementType A[],int nItems);
const int maxsize = 15;
ElementType E[15];
int main()
{
fin.open("element.dat");
loadarray(E,1);
return 0;
}
void loadarray(ElementType A[],int& nItems)
{
while(!fin)
{
fin>>A[i].Name;
fin>>A[i].atomicmass;
fin>>A[i].atomicnumber;
fin>>A[i].density;
i++;
}
}