Je reçois l'erreur LNK2001. Le code a été inclus ci-dessous. Quelqu'un peut-il m'aider s'il vous plaît?erreur LNK2001 dans le code
Error 3 error LNK2001: unresolved external symbol "private: static class std::vector<struct _UpdateAction,class std::allocator<struct _UpdateAction> > InstrumentCache::actionTaken" ([email protected]@@[email protected][email protected]@[email protected][email protected]@@[email protected]@@[email protected]@A) PerformanceTest.obj
//UpdateAction.h
typedef struct _UpdateAction
{
enum FIS_ACTION {
ADDED,
UPDATED,
DELETED
};
int id;
int type;
int legacyType;
FIS_ACTION action;
}UpdateAction;
typedef std::vector<UpdateAction> ActionTakenVector;
// InstrumentCache.h
#include UpdateAction.h
class InstrumentCache
{
public:
static ActionTakenVector& GetApplicationUpdateVector()
{
return actionTaken;
}
static void ClearApplicationUpdateVector()
{
actionTaken.clear();
}
private:
static ActionTakenVector actionTaken;
};
//fisClient.h
#include "UpdateAction.h"
#include "InstrumentCache.h"
class FISClient
{
void FunctionOne()
{
ActionTakenVector& rV = InstrumentCache::GetApplicationUpdateVector();
InstrumentCache::ClearApplicationUpdateVector();
}
} ;
PerformanceTest.cpp
#include "fisClient.h"
Pour un article récent associé, voir: http://stackoverflow.com/questions/2470737/why-cant-initialize-the-static-member-in-a-class-in-body-or-in -the-header-fi –
duplication possible de [symbole externe non résolu sur les membres de la classe statique] (http://stackoverflow.com/questions/195207/unresolved-external-symbol-on-static-class-members) – Mark