0

I have an existing C++ solution which I have been building and running using Visual Studio 2019. I would like to build and run the application on Ubuntu using g++ and Visual Studio Code. What is the best way of achieving this? Most of the samples provided are building single .cpp file but my application consists of many .cpp files built into one application executable.

https://code.visualstudio.com/docs/cpp/config-linux How do I set up Visual Studio Code to compile C++ code?

I have installed the https://github.com/fernandoescolar/vscode-solution-explorer extension but that only enables me to browse the C++ solution. How to build the solution and being able to debug and run the C++ application?

Any advice and insight is appreciated.

Kok How Teh
  • 3,298
  • 6
  • 47
  • 85
  • 1
    Possibly relevant/helpful/duplicate: https://stackoverflow.com/q/29972270/10871073? – Adrian Mole Sep 21 '21 at 12:23
  • use MSBuild to build a `.proj` file – rioV8 Sep 21 '21 at 13:18
  • @rioV8 can you provide more details? I have installed dotnet sdk but I don't find msbuild command installed with it. – Kok How Teh Sep 22 '21 at 12:11
  • @AdrianMole ok, I have installed the extension but that only enables me to browse the C++ solution. How to build the solution and being able to debug and run the C++ application? – Kok How Teh Sep 22 '21 at 12:23
  • which C++ compiler do you want to use? MSBuild is just Like CMake and Make a build tool, if you install VS Community Edition you get a C++ compiler and build tool, MSBuild uses .proj files to specify what needs to be done – rioV8 Sep 22 '21 at 13:34
  • VS Code with g++ on Ubuntu. Not Windows! – Kok How Teh Sep 23 '21 at 00:15
  • I hope you find this answer helpful: **https://stackoverflow.com/a/75110946/20707965** – Mvg Jan 13 '23 at 15:38

2 Answers2

0

Use CMake and generate CMakeLists.txt from .sln and included .vcxproj using https://github.com/pavelliavonau/cmakeconverter cmake-converter -s MyProject.sln

Kok How Teh
  • 3,298
  • 6
  • 47
  • 85
0

In one of the sections, I provide information on how to build solution files in Visual Studio Code in Windows (I believe it is similar for other systems): https://stackoverflow.com/a/75110946/20707965

Mvg
  • 1
  • 2