Executable not running on a different computer

I compile it on my main computer with vscode and then I transfer it to a different computer and then I get this error message:

compatible with the version of windows currently running. check your computer's system information if an x86 (32-bit) or (64-bit) version of the program is required, then contact the software vendor

not working in another pc

Are you missing the first part of the error message?

It almost sounds like you're trying to run a 64-bit executable on a 32-bit machine. Googling that error message also shows several results for checking what machine your computer is running on, including this one which contains the exact error text and points the user to a 32-bit installer.

Maybe you need to compile to a 32-bit target like i686-pc-windows-msvc?


Thanks for the answer, I am a beginner in this language. I tried to build a normal program that contains

fn main()
    let name = "Ahmad";
    print!("Hello {}", name);

I work on windows 7 64 bit I have installed Rust and I used the following commands but it does not work the program does not work for example on windows 7 32 bit


cargo build

cargo build --target x86_64-pc-windows-gnu

crago build target.x86_64-pc-windows-msvc

but nothing it works


Does it work if you use the i686-pc-windows-msvc target?

Tip: Use rustc --print target-list to list all the known targets.

yes I do them and I choose my target, but it doesn't work in another pc for example


rustup set default-host i686-pc-windows-msvc

rustup toolchain install stable-gnu

it's just a simple code but nothing

Of course my 64 bit windows machine where I am compiling the project works fine but of course I try another 32 bit windows machine and 64 bit windows 10 and 64 bit windows 7, it doesn't work, the error comes back.

What does rustc -vV show?

rustc -vV

rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: x86_64-pc-windows-msvc
release: 1.62.1
LLVM version: 14.0.5

I even changed the system and installed windows 10 64 bit on vmware and used all these steps


But it's useless, as soon as I try to run it, for example on another system, the error message appears

What file are you copying to the other computer to try and run?

file in folder "Target\debug"

path : = "C:\Users\Administrator\Desktop\Rust_Project\SimpleHelloWord\target\debug"


The error popup says that you can't run 64bit executable on 32bit OS(assuming Google translate is correct). Note that you can install 32bit Windows on 64bit machine, which cannot execute 64bit program.

If you've installed the Rust toolchain with the rustup, try this command to build 32bit executable.

cargo build --target i686-pc-windows-msvc

Which produces an executable at


Make sure you've run the command below to install toolchain for 32bit windows.

rustup target add i686-pc-windows-msvc
1 Like

Thanks, I tried this solution

rustup target add i686-pc-windows-msvc
cargo build --target i686-pc-windows-msvc

but now the error message has changed


You will need to install the right version of the Visual C++ Redistributable on the target pc. Installers for programs generally do this automatically for you. You can find them at Latest supported Visual C++ Redistributable downloads | Microsoft Docs To be precise I believe you need the one under the " Visual Studio 2015, 2017, 2019, and 2022" section.

Another option to what @bjorn3 wrote is to statically link your binaries. This can be accomplished by creating (in your project directory) a file .cargo/config that contains:

rustflags = ["-C", "target-feature=+crt-static"]

It is, generally speaking, recommended that you link dynamically against the CRT.

Thank you Bjorn 3 I will try

But the problem is not on my computer. I have all distributions installed. I'm talking on another computer. We assume that I created a program and someone else is using it on another computer. I mean, every time I have to install these distros, it's tiring. I want is there a solution to build a program that can be used on all windows 32bit 64bit devices

Thank you, blonk , for the answer. Can you explain to me more how to create this folder and where to put it .cargo/config?

Do I create the file in the folder in C:\Users\Administrator\.cargo or in the my project folder

Can you tell me more how to create this file

Put the cargo/config in the project directory, next to the Cargo.toml. Here's a project that static links the CRT by default: GitHub - openqrnch/verboten: A service wrapper to start msvsmon in maximum Bad Idea mode.

Installers for programs normally ship and install the right redistributable version without user interaction when installing the program.

Thanks blonk I will try

Yes, I understand what you mean bjorn3, but the problem is how to build the program, I will try and answer you