So i'm trying to do a program where i input 3 values which are stored in a object and a fourth value which i generate from 2 of the other values and i store that object into a vector. That problem is that i'm getting an error from the generatesignature function and i dont know what the problem is. I think it might have something to do how i declare the header file and the other cpp file since i havent done alot of programming involving these. So i'm asking to see if anyone can see anything wrong with what i have done so far. The errors i'm getting are LNK1120 1 unresolved externals and the second one is LNK2019 unresolved external symbol
Project.cpp
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include "constants.h"
using namespace std;
int main()
{
vector<Data> dataVector;
struct Data newdata;
newdata.fname = "testfname";
newdata.lname = "testlname";
//add signature
newdata.signature = generateSignature("testfname","testlname",dataVector);
newdata.height = 1.85;
dataVector.push_back(newdata);
for (int i = 0; i < dataVector.size();i++) {
cout << dataVector.at(i).fname << " " << dataVector.at(i).lname + " " + dataVector.at(i).signature << " " << dataVector.at(i).height << endl;
}
}
constants.h
#pragma once
#ifndef CONSTANTS_H
#define CONSTANTS_H
#include <string>
#include <vector>
using namespace std;
struct Data {
string fname;
string lname;
string signature;
double height;
};
string generateSignature(string fname, string lname, vector<Data>& data);
#endif
constants.cpp
#include "stdafx.h"
#include "constants.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string generateSignature(string fname, string lname, vector<Data>& data) {
string signature+=fname;
signature+="test123";
//some random code for the vector
return signature;
}