I'm use some 3-rd party library at my project. After updating to new version of library I'm faced with errors.
One my class have method
virtual RTSPServer::RTSPClientSession* createNewClientSession(u_int32_t sessionId)override;
but in new version of library declaration of RTSPClientSession was moved into another class and renamed. Now correct name is
GenericMediaServer::ClientSession
I need a code which will be correctly compiles with all versions of library.
At gcc I use following code:
#ifdef RTSPServer::RTSPClientSession
using ClientSessionClass = RTSPServer::RTSPClientSession;
#else
using ClientSessionClass = GenericMediaServer::ClientSession;
#endif
class A
{
.........
virtual ClientSessionClass* createNewClientSession(u_int32_t sessionId)override;
};
but this not work in MSVC 2010. How I can detect which declaration I should use?
UPD: code for gcc also don't work for old version of library :(
"How I can detect which declaration I should use?"
You need to introduce some discriminator for the library version you're using with your current build configuration:
#ifdef OLD_LIBRARY_VERSION // Maybe the binding headers have some information like this.
// If not you have to select this manually, and provide the
// setting with your project configuration.
using ClientSessionClass = RTSPServer::RTSPClientSession;
#else
using ClientSessionClass = GenericMediaServer::ClientSession;
#endif
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.