diff --git a/.gitignore b/.gitignore index 4a0ec41..ad9d8ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,13 @@ ### Rust template # Generated by Cargo # will have compiled files and executables -debug/ -target/ - +**/debug/ +**/target/ +**/*.exe +**/*.pdb # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock +**/Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk diff --git a/1.hello_world/main.rs b/1.hello_world/main.rs new file mode 100644 index 0000000..63c90d9 --- /dev/null +++ b/1.hello_world/main.rs @@ -0,0 +1,7 @@ +// 编译 +// rustc ./main.rs + +// 主函数入口 +fn main() { + println!("Hello World"); +} diff --git a/2.hello_cargo/Cargo.toml b/2.hello_cargo/Cargo.toml new file mode 100644 index 0000000..19c7b36 --- /dev/null +++ b/2.hello_cargo/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "hello_cargo" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2.hello_cargo/src/main.rs b/2.hello_cargo/src/main.rs new file mode 100644 index 0000000..df3a1fe --- /dev/null +++ b/2.hello_cargo/src/main.rs @@ -0,0 +1,6 @@ +// Cargo 创建项目 +// cargo new hello_cargo + +fn main() { + println!("Hello, world!"); +}