Xcode openframeworks file into visual studio openframeworks file

I have created an openframeworks project in xcode and would like to run it on my laptop that uses visual studio and then make an exe file from visual studio. is it possible and how?

you could make a new empty windows VS project and then cut and paste your code from the mac project into the windows project?

that is a last resort option however thanks for mentioning it. are there any things i should be wary of for my program thats been made in xcode?

Hi @ali312312

-generally- the code will port from one platform to another with no problem at all - the Xcode elements are for helping in the IDE mostly - (you can compile your code on a mac from the command line in the terminal if you like :slight_smile: ) you could just copy over the /src folder from one machine to another as well.

I just did this. Visual Studio runs the project fine, but in order for Intellisense etc. to recognize stuff there are a few settings to put in. Answer for VS Code on Mac

  1. Drag the project folder into VS Code
  2. Provide VS Code the include path to your libs & addons folder. This is in the file .vscode/c_cpp_properties.json, which VS Code’s Intellisense automatically looks for to find #includes (with the C++ Extension Pack enabled). Here’s my file, everything was auto-generated by VS Code except the openFrameworks paths which I added.
{
  "configurations": [
    {
      "name": "Mac",
      "includePath": [
        "${workspaceFolder}/**",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/",
        "~/Documents/OpenFrameworks/libs/**", // Path to OpenFrameworks libs
        "~/Documents/OpenFrameworks/addons/**" // Path to OpenFrameworks addons
      ],
      "defines": [],
      "macFrameworkPath": [
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
      ],
      "browse": {
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
      },
      "compilerPath": "/usr/bin/clang",
      "cStandard": "c17",
      "cppStandard": "c++17",
      "intelliSenseMode": "macos-clang-arm64"
    }
  ],
  "version": 4
}
  1. Any addons you use need to be added as single line module names to the addons.make file. For example, I was using the ofxGui module so my addons.make just has:
ofxGui
  1. You can compile the program with the Terminal command make in the project directory. You can run it with make RunRelease. So I just run make && make RunRelease to execute the program.

This worked for me! I much prefer VS Code to Xcode personally.

If the above question is: I have a Xcode OF project on Mac and I want to compile it on Windows with Visual Studio.

The easiest thing to do would be to:

  • download the VS version of OF ( 0.11.2 or the nighty builds at the bottom of the download page ).

  • Follow the setup instructions here: visual studio | openFrameworks

  • Copy the project folder eg: myOFProject from your Mac to PC and put it in OF_FOLDER/myApps/myOFProject.

  • Copy any addons over that aren’t included in the OF download to the OF_FOLDER/addons/ folder on your PC.

  • Open the ProjectGenerator on the PC ( in root of the OF folder ) and select the project folder via the import button.

  • Then hit Update.

Then you should be able to open the project in Visual Studio and build it without issue.

Note: Try to choose a matching version of OF so if you are using 0.11.2 on Mac use 0.11.2 on PC.

Thanks this is extremely helpful and exactly what i was looking for.

is there a difference between visual studio and visual studio code for this step. I also prefer visual studio however due to some circumstances i was making my project in xcode and need it to be done onto visual studio.

There is I think. My answer was for VS Code as a Mac app.

@ali312312 if you are on Windows I think using Visual Studio as I mentioned above will be the most straightforward.

If you are on a Mac and don’t want to use Xcode @joshuatazrein 's guide is the way to go.

It is possible to use VS Code on Windows but it is a more involved setup.

well the situation is that I had used xcode to make a project with only openframeworks but my school wants it done on windows visual studio so i am having to transfer everything and make it work on visual studio. Also I prefer visual studio rather than visual studio code anyway and the more steps there are for something like vs code will mean theres more things to mess up if not done right so I just want to make my Xcode project work on my windows pc with visual studio then be able to do things like run the program, make an exe file and create a makefile.

1 Like

That all makes sense. The Visual Studio steps I shared should be all you need then :slight_smile:
Good luck!

Just wanted to update everyone. I copied the src files and managed to create a new project and just put those src files. I ended up running into a debug assertion error that wasnt caught on xcode but was caught on visual studio. I have now fixed it and the project works perfectly. Thanks to everyone that helped.