خرید بک لینک

Vote count: -2

I have the following files

  1. myMainClass.h / myMainClass.cpp

  2. myFirstClass.h / myFirstClass.cpp

  3. mySecondClass.h / mySecondClass.cpp

myMainClass.h includes the following:

#include <unordered_set>

//private
typedef std::unordered_set<SomeClass, SomeClass_hash> SomeCollection;
SomeCollection m_myCollectionQueue;

// other variables blah blah

myMainClass.cpp includes myFirstClass.h and mySecondClass.h as it uses instances of them. myFirstClass.cpp and mySecondClass.cpp both include myMainClass.h.

When I build I get the following error:

error LNK2005: "class std::unordered_set,class std::allocator > m_myCollectionQueue" (?m_myCollectionQueue@@3V?$unordered_set@SomeClass@@SomeClass_hash@@U?$equal_to@UBackgroundOperation@@@std@@V?$allocator@SomeClass@@@4@@std@@A) already defined in myFirstClass.obj

How can I solve this? I notice that other variables I have declared in myMainClass.h don't force this error only the unordered_set.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 20 ارديبهشت 1395 ساعت: 0:14

صفحه بندی