簡體   English   中英

g++.exe: 安裝問題, cannot exec `as': No such file or directory

[英]g++.exe: installation problem, cannot exec `as': No such file or directory

I'm trying to learn C++, I downloaded and installed g++ on Windows using Cygwin, following this tutorial: https://www.cs.odu.edu/~zeil/cs250PreTest/latest/Public/installingACompiler/#installing-the- mingw 編譯器

就像在教程中一樣,最后,我檢查是否安裝了 g++:

PS D:\Desktop\coursera_ODS_in_c-\Week 2> g++ --version
g++.exe (GCC) 3.4.5 (mingw-vista special r3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

然后我嘗試運行這段代碼:

#include <iostream>

int main() {
    int num = 7;
    
    std::cout << "Values:" << num << std::endl;
    std::cout << "Address: " << &num << std::endl;
    return 0;
}

通過使用這個

PS D:\Desktop\coursera_ODS_in_c-\Week 2> g++ main.cpp

但我明白了:

g++.exe: installation problem, cannot exec `as': No such file or directory

你如何解決這個問題?

消息:

g++.exe: installation problem

明確指出您的 G++ 編譯器的安裝有問題。 另外,3.4.5 版本太舊了。 當前的穩定版本是 10.2(2020 年 7 月 23 日發布),用最新版本重新安裝它可能會解決您的問題。 (由於沒有給出足夠的細節,錯誤原因仍然是個謎。)

嘗試下載最新版本附帶的 GNU GCC 編譯器: GNU GCC

OTOH,程序編碼正確, OnlineGDB上沒有報告錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM