fn main() { // 检查是否为 Windows 目标 let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); if target_os == "windows" { // 第二个参数传入空的数组引用,表示不定义额外的宏 embed_resource::compile("resources.rc", [] as [&str; 0]); } }