<code>#include <unordered_map>
#define LIBRARY
#if defined(LIBRARY)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT __declspec(dllimport)
#endif
struct Base {
double d1;
double d2;
double d3;
/* It can be built if I uncommon the following code. */
//bool operator==(const Base& rhs) const {
// return true;
//}
};
struct EXPORT Derived : public std::unordered_map<int, Base> {};
int main() {
Derived d;
return 0;
}
</code>
<code>#include <unordered_map>
#define LIBRARY
#if defined(LIBRARY)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT __declspec(dllimport)
#endif
struct Base {
double d1;
double d2;
double d3;
/* It can be built if I uncommon the following code. */
//bool operator==(const Base& rhs) const {
// return true;
//}
};
struct EXPORT Derived : public std::unordered_map<int, Base> {};
int main() {
Derived d;
return 0;
}
</code>
#include <unordered_map>
#define LIBRARY
#if defined(LIBRARY)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT __declspec(dllimport)
#endif
struct Base {
double d1;
double d2;
double d3;
/* It can be built if I uncommon the following code. */
//bool operator==(const Base& rhs) const {
// return true;
//}
};
struct EXPORT Derived : public std::unordered_map<int, Base> {};
int main() {
Derived d;
return 0;
}
It can be built if I defined operator== in Base or I remove the EXPORT sign in front of Derived.
I mainly confused how does the EXPORT sign affect the building process?