samedi 22 avril 2017

undefined reference to C++ [duplicate]

This question already has an answer here:

I have an issue with my C++ program, I am receiving an "undefined reference to" error and I cannot track down the source of it.

The exact errror is: undefined reference to Action::StringStore[abi:cxx11]

Here is a bit from my action.h file:

class Action {
public:
    static std::map<std::string, std::string> StringStore;
...

And in my action.cpp file I have the following code:

Action::StringStore["session_id"] = "abc123";

I thought that this may be caused by not properly including the header file however action.cpp contains other constants and structs which are declared and defined in the action.h file.

I would appreciate if someone could shed some light on this.

Aucun commentaire:

Enregistrer un commentaire