I'm working on a UE4 demo with C++ now. To do something with procedural mesh, I defined a custom class named Point, which was pretty simple. And to avoid creating duplicate points during some processes, I defined a static unordered_set to store cached points, with the key type of Point*.
#pragma once
#include <unordered_set>
#include <math.h>
namespace Grid
{
    class Point
    {
    public:
        float X;
        float Y;
        float Z;
    public:
        Point(float, float, float);
        static Point* CreatePoint(float, float, float);
        static void ClearCache();
    private:
        static size_t CachedNum;
        struct PointHash
        {
            size_t operator()(const Point* P) const
            {
                std::size_t HsX = std::hash<float>()(P->X);
                std::size_t HsY = std::hash<float>()(P->Y);
                std::size_t HsZ = std::hash<float>()(P->Z);
                return (HsX ^ (HsY << 1)) ^ HsZ;
            }
        };
        struct PointEqual
        {
            bool operator()(const Point* P1, const Point* P2) const
            {
                return (fabs(P1->X - P2->X) < 1e-6) && (fabs(P1->Y - P2->Y) < 1e-6) && (fabs(P1->Z - P2->Z) < 1e-6);
            }
        };
        static std::unordered_set<Point*, PointHash, PointEqual> CachedPoint;
    };
}
The simplified codes are above, I defined a custom hash func and equal func, but could not compile with the LNK 2001 error: unresolved external symbol "private: static class std::unordered_set<class Grid::Point *,struct Grid::Point::PointHash,struct Grid::Point::PointEqual,class std::allocator<class Grid::Point *> > Grid::Point::CachedPoint". Can anybody show me where the problem is?
With the empty .cpp file, the project can build successfully.
 
    