How do I get c++ to work on Visual Studio for Mac? RRS feed

  • Question

  • It's been a long time since I was a programmer. I'm taking an intro to c++ and everyone else in the class is on Windows. I'm on a Mac. I've been using an editor and the command line (in Terminal) g++ compiler. It's been working fine.

    However, the professor wants me to use Visual Studio. I downloaded it and installed it on my Mac. So far so good.

    When I try to create a c++ project/program it only gives me the option of creating c# programs, at least it doesn't give a c++ option.

    So, how can I write and run c++ programs on Visual Studio on a Mac?

    Thank you.

    • Moved by Sheethal J S Thursday, March 2, 2017 7:19 AM Not related to VSTS
    Wednesday, March 1, 2017 3:13 PM

All replies

  • Hi OrchestraMusic,

    Welcome to the MSDN forum.

    Now we have two Visual Studio versions (Visual Studio for Mac, Visual Studio Code) that can directly install on the Mac (macOS), refer to your description, it looks like you installed the Visual Studio for Mac, it is a developer environment optimized for building mobile and cloud apps with Xamarin and .NET. There has no option to create C++ project in this version and some other community members reported this suggestion to the Visual Studio Product Team, please check this: Support C++ in Visual Studio for Mac and you can vote it, then waiting for the feedback from the Visual Studio Product Team.

    >> So, how can I write and run c++ programs on Visual Studio on a Mac?

    As far as I know, there have two options as below:

    1. Install Visual Studio Code and C/C++ build tools, please have a look at blog: Building your C++ application with Visual Studio Code
    2. Create a VM that OS is windows, then install the Visual Studio Community and choose the option C++ to install during the VS installation

    If you just want a lightweight tool to edit your C++ files, VS Code has you covered but if you want the best possible experience for your existing Visual C++ projects or debugging on Windows, we recommend you use a version of Visual Studio such as Visual Studio Community.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, March 3, 2017 2:12 AM
  • The official answer is completely unsatisfactory, but is entirely correct. Visual Studio for Mac (VSM) doesn't support building C++ projects out of the box. Fortunately there are other options. VSM still supports building using external tools, and since you (most likely) already have a C++ compiler on your machine, you can just compile using any external build tool. VSM will work somewhat OK as an editor for C++ projects, but will not be suitable as a proper IDE. Jetbrains have better tools anyway, so you might want to have a look at those; Rider for C# and CLion for C++ are both excellent tools.
    Friday, December 7, 2018 7:21 AM
  • Thanks for these details, that is much appreciated!
    Wednesday, April 3, 2019 7:27 AM