Is it possible to develop a C++ application in Visual Studio to run on Linux?

Asked

Viewed 590 times

3

I have to develop an application for Linux in C++ and wanted to know if it is a good use Visual Studio 2017 in Windows for such task?

I wanted to know the pros and cons, because I saw that the VS has an extension for this.

2 answers

4


If it’s a good one it’s a matter of opinion and I’ll abstain.

It’s possible, and a lot of people do. Microsoft’s C++ meets the C++17 standard (the last of this year) by almost 100% and, if I’m not mistaken, already 100% of the C++14 or at least of the C++11, which few people use all this that has just entered the standard.

C++ comes with Visual Studio and you might as well use it. Some people like to use Resharper C++ with complement, even if it has cost. Remembering that the VS Community is very complete and free.

C++ compiler lets you generate executable cross Platform, then even in Windows you can generate the executable for Linux. You can even remotely debug the application on Linux. But it is still possible to run the Linux executable on current Windows itself (technically it is a container with an Ubuntu). But you can debug as a Windows executable and only at the end generate a Linux executable. If you make portable code, the recommended, is quiet.

For my workflow is how I would do, especially the last option.

  • That was unthinkable some time ago! Linux and Windows were like water and oil, they didn’t mix. Will we have a fully hybrid operating system in the future?

  • No, but they’ll be working more and more together.

1

Even with the ease of compilation multiplatform offered by Visual Studio 2017, still yes it would be necessary a specific implementation for each operating system.

This happens because the operating systems that implement the standard POSIX (such as Windows and Linux), provide programming interfaces (Apis) different.

Even using a programming language quite portable like C++, it would still require the implementation of a specific code to interact with each of the Apis of the various existing operating systems.

The same happens with the stage of debugging, that at all times happens in running time and will always be done in "unorthodox".

If the issue of cross-platform portability and compilation is a very important and relevant factor for your project, maybe JAVA is a more suitable language than C++, which rules out all the complexities mentioned here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.