Suggestions on having consistent code over platforms.

Hello forum!
I’m a windows but recently started using OS X and ubuntu. openF works great on them too.
I ported an application over from Windows to OS X in order to use ofxSyphon but now I want to be able to code it on one platform or the other and there is no Syphon on Windows.

I know PreCompiler Directives can help me discard code in different platforms so I’ll use that. Do you guys have any other suggestions?
How about adding plugins?

As always thank you! :smiley:

The compiler sets a DEFINE based on what platform you’re compiling for. Any code you only want to be compiled only on OSX just wrap in the right ifdef block like so:

#ifdef __OBJC__  
// my OSX only code here, even Objective-C like:  
@class UVCCameraControl;  

(That example comes from the ofxUVC addon. You can see more examples in its source code here:

Thank you :smiley:
Any other suggestions?
I remember openF came with project files ready for every platform.

Can anyone explain how that was done?

That was done using the Project Generator. The core team uses that to generate all the project files for Mac/Win/Linux for all the examples. You can see the source code for the PG here:

Just what I needed to know :smiley:
Thank you gregab