I read this good [post](https://stackoverflow.com/questions/7092765/what-does-it-mean-to-have-an-undefined-reference-to-a-static-member) (on undefined-reference-to-a-static-member), but i from what i can see i dont always required to defined the static member in the cpp. So i am asking for help to understand the rules.

**several examples - all examples without def in the cpp.
In the h file for class Master declaration is :**

```
class Master{
public:
    static IDataSynchronization& sync_data_cb_;
}

```

**In cpp:**

```
void Master::start(IDataSynchronization& syncDataCB);   - error for undefined
void Master::start(int p,IDataSynchronization& syncDataCB);  no error

```

//Here is use in the static sync\_data\_cb\_
 void Master::sendData(){
 list data = sync\_data\_cb\_.syncData();
 list::iterator it;
 for (it = data.begin(); it != data.end(); ++it) {
 sendto(instance\_->data\_sock\_fd\_, (\*it).c\_str(), (\*it).length(), 0,(const struct sockaddr \*) &instance\_->target\_host\_data\_, instance\_->sockadd\_length\_);

```
    }
}

```

for this class:

```
class Logger {
public:
    static void Log(const char *format, ...);
private:
    static FILE* file_;
    static mutex mtx_;
};

```

If in another classes that i declared static static FILE\* (and used it in the class methods) i dont getting an error for undefined it.

**I am using in these static memners in all cases.**

Can anyone clear the ruled for me?

Thank you