1. 程式人生 > >C++編譯之提示ld: can't open output file for writing: test1, errno=21 for architecture x86_64

C++編譯之提示ld: can't open output file for writing: test1, errno=21 for architecture x86_64

1 問題

在mac 終端寫了一個cpp檔案,然後用命令編譯執行提示錯誤如下

1111deMBP:code a1111$ g++ -std=c++11 test1.cpp -o test1
ld: can't open output file for writing: test1, errno=21 for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

 

 

2 解決辦法

應該是這個目錄上有2個 test1.cp檔案存在,只要修改這個檔名字編譯就行

mv test1.cpp test123.cpp