したがって、静的メンバーを含むヘッダー ファイルがあります。
#ifndef PROFILE_MANAGER_H
#define PROFILE_MANAGER_H
#include <map>
#include <vector>
using namespace std;
using std::vector;
namespace Engine
{
class ProfileManager
{
private:
static map<const char*, vector<float>> profiles;
static map<const char*, vector<float>>::iterator it;
static pair<map<const char*, vector<float>>::iterator, bool> ret;
};
}
#endif
そして私のcppファイルには定義があります:
#include "ProfileManager.h"
namespace Engine
{
map<const char*, vector<float>> ProfileManager::profiles;
map<const char*, vector<float>>::iterator ProfileManager::it;
pair<map<const char*, vector<float>>::iterator, bool> ProfileManager::ret;
}
cpp ファイルで静的メンバーを定義したにもかかわらず、リンカは常に静的メンバーが未解決の外部 (LNK2001) であると不平を言います。理由についてのアイデアはありますか?