iT邦幫忙

0

vscode C++ "."不是內部或外部命令可執行的程式或批次檔

  • 分享至 

  • xImage

各位大大好,想問一下vscode C++ run code 問題。

目前我在vscode中,是根據官網用MSYS2的方法下載MinGW工具鏈,
gcc --verison
g++ --verison
gdb --verison
都是有結果跑出來,確認安裝好的,到建置檔案都沒問題
問題是當我要執行檔案時,在終端機輸入./test.exe卻出現
「"."不是內部或外部命令可執行的程式或批次檔」

目前已經嘗試過網路上的方法,在環境變數中加入%SystemRoot%\system32;等路徑,
但是結果還是跑不出來,求大神幫幫忙
code

看更多先前的討論...收起先前的討論...
在終端機的窗口輸入 where test.exe 找到你要執行的程式看跑哪去了
gordon_tw iT邦新手 5 級 ‧ 2024-04-17 08:49:23 檢舉
vscode terminal keyin 當時的路徑跟test.exe的路徑確定是同層的嗎?
netstated iT邦新手 5 級 ‧ 2024-04-17 09:02:19 檢舉
執行的路徑符號錯了,Windows的路徑符號應是 \ 。
是同層的喔,但是平常我在另一台電腦打 ,都是用 ./test.exe而且./會出現黃色這樣
但的確,.\後就跑得動了,感恩!!
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
derek_lan
iT邦新手 2 級 ‧ 2024-04-17 11:28:04

直接test.exe就可以了吧
或者.\test.exe看看

0

You can go to File > Preferences > Settings and search for tasks.json. Click on Open settings.json. Paste the following code into your tasks.json file, replacing <your_compiler> with the actual path to your C++ compiler. Retro Bowl

mobone iT邦新手 5 級 ‧ 2024-04-17 16:24:01 檢舉

This guys just type wrong command to run exe /images/emoticon/emoticon10.gif

我要發表回答

立即登入回答