即使安装成功,在 Ubuntu 上的 V.S.Code 上运行 C++ 时也遇到错误

问题描述 投票:0回答:1

我在 Ubuntu 发行版上尝试在 V.S.Code 上运行 C++ 代码时遇到问题。我会从 V.S.Code 安装 C++ 扩展以及 C++ 的

mingw-64
g++ compiler
。我已正确遵循所有说明,但在运行时仍然会抛出错误,如下所述。 (运行正常的“Hello world”程序时会弹出 2 个终端并显示这些错误消息。)

  1. 从 gcc.exe 构建活动文件:
Starting build...
'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe' -g /media/ankkash/Stuffs/DEBUGS/Visual_Studio/PRactice/code.cpp -o '/media/ankkash/Stuffs/DEBUGS/Visual_Studio/PRactice\code.exe'
/bin/sh: 1: C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe: not found

Build finished with error(s).

 *  The terminal process failed to launch (exit code: -1). 
 *  Terminal will be reused by tasks, press any key to close it.
  1. 直接来自文件:
&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
/bin/bash: line 1: /media/ankkash/Stuffs/DEBUGS/Visual_Studio/PRactice/code.exe: cannot execute binary file: Exec format error
/bin/bash: line 1: /media/ankkash/Stuffs/DEBUGS/Visual_Studio/PRactice/code.exe: Success
[1] + Done                       "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-poe4fz15.le1" 1>"/tmp/Microsoft-MIEngine-Out-fhgskzqx.ywu"

自从我最近转向 Ubuntu 以来,我只是想开始使用 C++。但即使在以正确的方式完成所有步骤后仍遇到这些错误消息。搜索时找不到解决此问题的方法。我希望我能在这里找到解决办法。

ubuntu gcc compiler-errors
1个回答
0
投票

我想更好地了解你想做什么。据我所知,你有一台运行 Ubuntu 的机器,对吧?如果是这种情况...您是否正在尝试编写一些在 Windows 下运行的程序,但尝试在 Ubuntu 中执行它?

您无法在 Linux 发行版下运行 Windows 可执行文件,或者也许可以,但无法按照您尝试的方式运行。我想提供更多信息,但我认为我自己需要更多背景信息才能更好地理解这一点。您遵循什么指示?

© www.soinside.com 2019 - 2024. All rights reserved.