Wednesday, 15 July 2015

C++ Error linking in consumer file caused by static data field -


I want to use a static global variable as Mute X. When I try to compile the following code:

  // header file class __declspec (dllexport) StateSonverter {private: StateConverervator (); StatSenswaters (Constant Counselor and;); Protected: const CString m_oldConf; CContainer & amp; M_container; Fixed force x_mutex; Public: StateConservator (CContainer & Container, Constant Cstring & Conf): m_container (container), m_oldConf (!? X_mutex container.GetConf (): _T ("")) {if (! X_mutex) {x_mutex = True m_container.SetConf (conf); }} ~ State Concerter () {if (x_mutex) {x_mutex = false; M_container.SetConf (m_oldConf); }}}; // CPP File Bull StateSonverter :: x_mutex = false; // Consumer File StateSourceWare CS (* pContainer, pDoc-> GetConfiguration ());  

I get an error:

Consumer.obj: LNK2001 Error: Unsolved exotic symbol "secure: static bool StateConservator :: x_mutex"? (X_mutex @

UPDATE

I created two, please

to test the problem only The minimum program with the necessary part and they work! It's getting weird!

Update 2

After class __DCPSP Delexport) Declare, it was missing.

Sorry, people

I was defining the code of the statissorator in the related file of the project But after I realize it will be more understood in the second file.

I was not feeling the second file was part of another solution, therefore, I have not compiled the second solution, so Error.

I think I need an extension to Visual Studio to color the tabs of other projects with any other color, if someone knows about anyone, I would appreciate it.

Thank you for supporting the annoyance made by me.

UPDATE

Notice __DCPSP Dilexport) The announcement after the class, which was missing.


No comments:

Post a Comment