4

I have a small console based, standards compliant, C++ program that I developed in Visual Studio on Windows. Since it is in standard C++, is all I need to do is compile it for OSX? or am I being overly optimistic?

I am looking for the easiest and most straightforward way to do this. Is it possible to do from Visual Studio 2012 Professional? If necessary I have access to a Mac. However, since my dev platform is Windows, it would be nice if I could do it from here.

I'm not experienced with mac development at all. When you compile an application for OSX, what do you get instead of a .exe?

  • 1
    There will probably be some work, since no compiler is good at telling you if your program is well defined. And VC++ isn't a great tool to test if your program is standards-compliant. You won't have to rewrite it, but you'll be making improvements here and there. – Drew Dormann Sep 22 '12 at 14:14
  • see - http://stackoverflow.com/questions/253768/porting-c-code-from-windows-to-the-mac?rq=1 – enderland Sep 22 '12 at 14:15

2 Answers2

5

If you don't mind installing MinGW or Cygwin to your Windows machine, you can build a Windows to OS X cross-toolchain as per the instructions here: https://github.com/Tatsh/xchain

4

I would get an OSX system (a VM is fine), install XCode and then compile your code using that. Should be trivial if your C++ code is written in a cross platform way.

user788171
  • 16,753
  • 40
  • 98
  • 125
  • Running OSX in a VM that is not hosted on another OSX system is a license violation. Not the best way to start development for a new target. – Bo Persson Sep 22 '12 at 14:46
  • I'll see if I can go get my hands on a system with XCode. Thanks –  Sep 22 '12 at 14:59
  • @Kyryx you don't necessarily need XCode. You could build your code on any *nix platform using `g++`, `gnu make` together with CMake or scons, then trivially port to OSX. – juanchopanza Sep 22 '12 at 15:18
  • Quick google of "macos vm online" and you will find for a relatively low monthly price you can get remote access to a Mac VM for development. There are at least 5 providers. – Zv_oDD Jan 16 '17 at 02:53