简体   繁体   中英

Member Variable from one class to another

I am unable to resolve this error.

Source1.h// it has Class CSystem

               static PvGenInteger *lIPAddressParam;

Source2.cpp //it has Class MGUI

             CSystem :: lIPAddressParam ;
             PvInt64 lIPAddress = 0;
         lIPAddressParam->GetValue( lIPAddress );

This gives the error:

Undeclared lIPAddressParam.

If i use this code line:

lIPAddressParam->GetValue( lIPAddress );

in a single source file, it works, but not in this case. Kindly guide. Thanks

// include in .cpp, static variables should be initialized in a compile time

PvGenInteger* CSystem ::lIPAddressParam;

issue is due to you ommited type of static variable in .cpp file; specify it and all should be fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM