Why release version can running, debug version can't runing?

⚓ Rust    📅 2025-09-10    👤 surdeus    👁️ 9      

surdeus

Warning

This post was published 64 days ago. The information described in this article may have changed.

win10 64bit, MinGW64, rust 1.89.

fn main() {
    println!("Hello world");
}

release can running.

Administrator@DESKTOP-CFR0G27 MINGW64 /e/rustProject/hello (master)
$ cargo b -r
    Finished `release` profile [optimized] target(s) in 0.13s

Administrator@DESKTOP-CFR0G27 MINGW64 /e/rustProject/hello (master)
$ ./target/release/hello.exe
Hello world

debug can't running

$ cargo r
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
     Running `target\debug\hello.exe`
error: could not execute process `target\debug\hello.exe` (never executed)

Caused by:
  %1 不是有效的 Win32 应用程序。 (os error 193)

You can access https://github.com/wqkuang/rust_hello to get this project and hello.exe.

7 posts - 5 participants

Read full topic

🏷️ Rust_feed