Compatibility issue with addon

Hello,
I’m developping an addon that works fine with oF v0.8.3 but doesn’t work with v0.9.0 because of a method that uses a deprecated function. So I rewrote this method to work with v0.9.0. The question is: how do I make my addon work with both versions?
Thanks in advance!

You can use OF_VERSION_MAJOR, OF_VERSION_MINOR and OF_VERSION_PATCH. Then use #if blocks to use different code like:

#if OF_VERSION_MINOR==9
// version 9 code
#elif OF_VERSION_MINOR==8
// version 8 code 
#else
ofLogError() << "Unsupported OF version";
#endif

Notice v0.9.0 isn’t released yet, so values at master are still v0.8.4… but I’m guessing you can check the patch instead of minor number.

2 Likes

Perfect! Thank you very much!

1 Like