Thursday, May 5, 2022

[SOLVED] Visual Studio C++ Project for Linux, how to run .out file?

Issue

Im using Visual Studio 2022 and have created a C++ project for linux.

I followed this article: href="https://docs.microsoft.com/en-us/cpp/linux/connect-to-your-remote-linux-computer?view=msvc-170" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/cpp/linux/connect-to-your-remote-linux-computer?view=msvc-170

And got a running OpenGL-application in Linux via Remote Debugging in Visual Studio.

enter image description here

I see a .out-file in Linux but I can not run it.

enter image description here

So, how do I compile an executable file, so I can run it on Linux Mint? I am using Linux Mint.


Solution

As you are using linux, you can use cpp or g++ for compiling your code. Linux usually have the g++. Run it by g++ filename.cpp and you will get a ELF file named a.out, you can execute this by the command ./a.out. If you couldn't run or your code check for the modes on file with ls -la command and if you can't find the letter -x in your files mode then use the command chmod +x filename .Hope this solves the problem.



Answered By - hari hara sankar
Answer Checked By - Marilyn (WPSolving Volunteer)