Rustのコンパイルエラー対応

公式サイト

 

error: linker cc not found

Cのコンパイラがインストールされていない場合、下記エラーが表示される。

/workspaces/rust_devcontainer (master) $ 
error: linker `cc` not found
|
= note: No such file or directory (os error 2)

error: aborting due to previous error

/workspaces/rust_devcontainer (master) $ 

Ubuntuの場合

build-essentialをインストールする。

sudo apt install -y build-essential

インストール後、再度コンパイルすることで問題なく実行できる。

vscode ➜ /workspaces/rust_devcontainer (master) $ 
vscode ➜ /workspaces/rust_devcontainer (master) $ ./main
Hello World!

参考URL
https://omohikane.com/rust_cargo_build_linker_cc_not_found/

bannerAds