在另一台Windows机器上运行Rust编译程序有什么要求? [英] What is the requirements for running a Rust compiled program on another Windows machine?
问题描述
我对Rust完全陌生.我在Windows 10计算机上安装了Rust.创建了一个简单的helloworld程序,如下所示:
I'm totally new to Rust. I installed Rust on my Windows 10 machine. Created a simple helloworld program like this:
fn main() {
print!("Hello world!");
}
并使用 rustc rust.rs
对其进行编译.之后,将生成两个文件:
And compiled it with rustc rust.rs
. After that there are two files generated:
admin@myserver MINGW64 ~/Documents/rust_test
$ ls -latrh
total 1.6M
drwxr-xr-x 1 admin 197121 0 Sep 2 03:28 ..
-rw-r--r-- 1 admin 197121 45 Sep 4 00:26 rust.rs
-rwxr-xr-x 1 admin 197121 146K Sep 4 00:26 rust.exe
-rw-r--r-- 1 admin 197121 1.5M Sep 4 00:26 rust.pdb
drwxr-xr-x 1 admin 197121 0 Sep 4 00:26 .
我可以成功运行 rust.exe
并获得正确的结果.但是,当我将 rust.exe
复制到另一个新创建的Windows 2016虚拟机并运行它时,出现此错误:
I can successfully run rust.exe
and get the proper result. However, when I copy rust.exe
to another newly created Windows 2016 virtual machine and run it, I got this error:
我的问题是,在未安装Rust的计算机上运行Rust编译程序有什么要求?我是否还需要在其上安装 vc ++构建工具
(就像在开发机上一样)?
My question is, what's the requirement to run a Rust compiled program on a machine that doesn't have Rust installed? Do I need to install the vc++ build tools
on it too (just as I did on the development machine)?
推荐答案
You need to install the Microsoft Visual C++ Redistributable Package in the correct version.
The "140" in the file name in your error message indicates the version, which should be the Visual C++ Redistributable for Visual Studio 2015.
作为快捷方式,以下是其他版本中最常见的下载链接:
As a shortcut, here are the most common dowload links for other versions:
- Microsoft Visual C ++ Redistributable 2017 — 32位(x86), 64位(x64)
- Microsoft Visual C ++ Redistributable 2015 — 32位(x86), 64位(x64)
- Microsoft Visual C ++ Redistributable 2012 — 32位(x86), 64位(x64)
- Microsoft Visual C ++ Redistributable 2008- 64位(x64)
- Microsoft Visual C ++ Redistributable 2005 — 64位(x64)
- Microsoft Visual C++ Redistributable 2017 — 32-bit (x86), 64-bit (x64)
- Microsoft Visual C++ Redistributable 2015 — 32-bit (x86), 64-bit (x64)
- Microsoft Visual C++ Redistributable 2013 — 32-bit (x86), 64-bit (x64)
- Microsoft Visual C++ Redistributable 2012 — 32-bit (x86), 64-bit (x64)
- Microsoft Visual C++ Redistributable 2010 — 32-bit (x86), 64-bit (x64)
- Microsoft Visual C++ Redistributable 2008 — 32-bit (x86), 64-bit (x64)
- Microsoft Visual C++ Redistributable 2005 — 32-bit (x86), 64-bit (x64)
这篇关于在另一台Windows机器上运行Rust编译程序有什么要求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!