I'm struggling with unresolved token and unresolved external symbol. I decided to leave the names of classes and variables as they are because I believe this will be easier this way to understand what I'm trying to do.
QuestionsSet.h
#include "Question.h"
class QuestionsSet{
private:
static std::vector<Question> questions;
public:
static Question getQuestion();
};
QuestionsSet.cpp
#include "QuestionsSet.h"
Question QuestionsSet::getQuestion() {
for (Question q : questions) {
if (!q.used) {
return q;
}
}
}
Class Question has a field "used" of type bool, which is false by default and turns true once question is used in the game. I think his is plain C++ yet I put "C++/CLI" in tags because this is a part of application using Windows Forms and maybe this matters in this case. I'm getting linker errors on any reference to vector questions.
The errors read:
Error LNK2020 unresolved token (0A00046C) "public: static class std::vector > QuestionsSet::questions" (?questions@QuestionsSet@@2V?$vector@VQuestion@@V?$allocator@VQuestion@@@std@@@std@@A)
Error LNK2001 unresolved external symbol "public: static class std::vector > QuestionsSet::questions" (?questions@QuestionsSet@@2V?$vector@VQuestion@@V?$allocator@VQuestion@@@std@@@std@@A)
Error LNK1120 2 unresolved externals
I've spent hours trying to figure it out but I can't seem to find the solution. I've searched for solutions yet none seemed to apply in this case.