要在Debian上运行Rust程序,您需要先安装Rust编程语言
打开终端(快捷键:Ctrl + Alt + T)
首先,更新您的系统包列表:
sudo apt update
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
这将下载并运行Rust安装脚本。按照屏幕上的提示操作。
rustc --version
如果看到Rust编译器的版本号,说明安装成功。
hello_world的新项目:cargo new hello_world
cd hello_world
src/main.rs文件,编写您的Rust代码。例如,您可以编写一个简单的程序,输出"Hello, world!":fn main() {
println!("Hello, world!");
}
cargo run
现在您已经知道如何在Debian上运行Rust程序了。您可以继续学习和开发更复杂的Rust项目。