简体   繁体   English

Visual Studio C++ 项目为Linux,如何运行.out文件?

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

Im using Visual Studio 2022 and have created a C++ project for linux.我使用 Visual Studio 2022 并为 linux 创建了一个 C++ 项目。

I followed this article: https://learn.microsoft.com/en-us/cpp/linux/connect-to-your-remote-linux-computer?view=msvc-170我关注了这篇文章: https://learn.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.并通过 Visual Studio 中的远程调试在 Linux 中获得了一个正在运行的 OpenGL 应用程序。

在此处输入图像描述

I see a.out-file in Linux but I can not run it.我在 Linux 中看到了一个.out 文件,但我无法运行它。

在此处输入图像描述

So, how do I compile an executable file, so I can run it on Linux Mint?那么,如何编译可执行文件,以便在 Linux Mint 上运行它? I am using Linux Mint.我正在使用 Linux Mint。

As you are using linux, you can use cpp or g++ for compiling your code.当您使用 linux 时,您可以使用cppg++来编译您的代码。 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 . Linux 通常有 g++。通过g++ filename.cpp运行它,你会得到一个名为 a.out 的 ELF 文件,你可以通过命令./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.如果您无法运行或您的代码使用ls -la命令检查文件模式,并且如果您在文件模式中找不到字母 -x,则使用命令chmod +x filename 。希望这可以解决问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Linux上有效地编译Visual Studio C ++项目 - How to compile a visual studio c++ project on linux efficiently 如何在运行时仅重建我的 C++ 项目中的一个文件来修复 Visual Studio 2019 - How to fix Visual Studio 2019 from only rebuilding one file in my C++ project when run 如何在 Visual Studio 项目中“单独”运行 C++ 文件而不受其他文件的影响? - How do I run a C++ file “by itself” in a Visual Studio project without the influence of other files? 如何在Visual Studio 2008(C ++项目)中重建项目后运行构建规则的项目 - How do I just run a projects post build rules with out rebuilding in Visual Studio 2008 (C++ project) 如何从其他C ++项目中构建和运行Visual Studio-8中的C ++项目? - How a C++ project in visual studio-8 can be build and run from other C++ project? 如何在 Visual Studio 代码中编译和运行 c++ 源文件 - How to compile and run a c++ source file in visual studio code 如何为Linux构建Visual C ++项目? - How to build a Visual C++ Project for Linux? 在包含make文件的Linux中创建的Visual Studio 2015中编译C ++项目 - Compiling a C++ project in Visual Studio 2015 created in Linux containing make file 最简单的方法是“移植”Visual Studio C ++项目以在Linux上编译? - Easiest way to “port” a Visual Studio C++ project to compile on Linux? 将 Visual Studio C++ 项目迁移到 Linux 和 CMake - Migrating a Visual Studio C++ Project to Linux and CMake
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM