I have beeen using this template to make my classes to store data for various parts of my program.
//Classs that DOES NOT work
//"MiningPars.h"
#pragma once
#ifndef MININGPAR_H
#define MININGPAR_H
#include <iostream>
#include <fstream>
using namespace std;
class MiningPars
{
public:
int NumYears;
double iRate;
int MaxMineCap;
int MaxMillCap;
int SinkRate;
double ReclaimCost;
double PitSlope;
public:
MiningPars();
MiningPars(int numYears,double irate,int maxMineCap,int maxMillCap,
int sinkRate, double reclaimCost, double pitSlope): NumYears(numYears),
iRate(irate),MaxMineCap(maxMineCap),MaxMillCap(maxMillCap),SinkRate(sinkRate),
ReclaimCost(reclaimCost),PitSlope(pitSlope) {}
};
#endif
when I just declare a new mining par, it gives me the error
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall MiningPars::MiningPars(void)" (??0MiningPars@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'par''(void)" (??__Epar@@YAXXZ)
i.e. my code looks like this:
#include "MiningPars.h"
MiningPars par;//Error
vector <PredecessorBlock> PREDS;//is okay
void main()
{
par.iRate = .015;
//... etc.
}
most MSDN and other google searches say that i am not declaring things correctly or i haven't added appropriate dependanies, but it is the same format that I created another class. an example of my other work can be seen here:
//Classs that works
#pragma once
#ifndef PREDECESSOR_H
#define PREDECESSOR_H
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class PredecessorBlock
{
public:
int BLOCKID;
vector <int> PREDS_IDS;
int PredCount;
public:
PredecessorBlock();
PredecessorBlock(int blockID,vector<int>predsids,
int predcount) : BLOCKID(blockID),
PREDS_IDS(predsids), PredCount(predcount)
{}
};
#endif
so this has been confusing for me. I appreciate any advice you may give