Решил познакомиться с языком. Скомпилировал обычный hello world. На том компьютере на котором компилировал, скомпилированная программка запускается без проблем. Скинул её на другой комп, а там она не запускается и просто вылетает ошибка. В чём может быть проблема?
Неплохо бы указать хотя бы ОС, на которых запускали и компилировали программу. Желательно с версиями этих самых ОС.
компилировал на win 10, вторая ос - win 8.1 professional
код
fn main() {
println!(“Привет, мир!”);
}
Какую именно ошибку пишет?
Какой именно версией компилятора собирал? i686 или x64? gnu или msvc?
Если через rustup ставил, то покажи что rustup show
говорит.
Как именно собирал? Просто cargo build
?
Можешь скинуть собранный файл?
всё, разобрался, почему-то до этого не выдавало ошибку с описанием, а просто вылетало сообщение, что работа программы прекращена. Сейчас выдало ошибку: отсутствует файл vcruntime140.dll.
Хотелось бы узнать, все программы на rust скомпилированные в windows зависят от установленных библиотек c runtime library?
Если я правильно понял
rust-lang:master
← alexcrichton:crt-static
opened 12:42AM - 03 Nov 16 UTC
This commit is an implementation of [RFC 1721] which adds a new target feature
… to the compiler, `crt-static`, which can be used to select how the C runtime for
a target is linked. Most targets dynamically linke the C runtime by default with
the notable exception of some of the musl targets.
[RFC 1721]: https://github.com/rust-lang/rfcs/blob/master/text/1721-crt-static.md
This commit first adds the new target-feature, `crt-static`. If enabled, then
the `cfg(target_feature = "crt-static")` will be available. Targets like musl
will have this enabled by default. This feature can be controlled through the
standard target-feature interface, `-C target-feature=+crt-static` or
`-C target-feature=-crt-static`.
Next this adds an gated and unstable `#[link(cfg(..))]` feature to enable the
`crt-static` semantics we want with libc. The exact behavior of this attribute
is a little squishy, but it's intended to be a forever-unstable
implementation detail of the liblibc crate.
Specifically the `#[link(cfg(..))]` annotation means that the `#[link]`
directive is only active in a compilation unit if that `cfg` value is satisfied.
For example when compiling an rlib, these directives are just encoded and
ignored for dylibs, and all staticlibs are continued to be put into the rlib as
usual. When placing that rlib into a staticlib, executable, or dylib, however,
the `cfg` is evaluated *as if it were defined in the final artifact* and the
library is decided to be linked or not.
Essentially, what'll happen is:
* On MSVC with `-C target-feature=-crt-static`, the `msvcrt.lib` library will be
linked to.
* On MSVC with `-C target-feature=+crt-static`, the `libcmt.lib` library will be
linked to.
* On musl with `-C target-feature=-crt-static`, the object files in liblibc.rlib
are removed and `-lc` is passed instead.
* On musl with `-C target-feature=+crt-static`, the object files in liblibc.rlib
are used and `-lc` is not passed.
This commit does **not** include an update to the liblibc module to implement
these changes. I plan to do that just after the 1.14.0 beta release is cut to
ensure we get ample time to test this feature.
cc #37406
On MSVC with -C target-feature=-crt-static
, the msvcrt.lib library will be
linked to.
то так сишная стандартная библиотека будет статически связана.
an76
07.Февраль.2017 11:24:40
7
Подскажите почему выдает ошибку couldn’t read “src\main.rs ”: stream did not contain valid UTF-8 при использовании кирилицы
А файл точно в кодировке UTF-8?
Вдруг там 1251.
Создал бы отдельную тему
Что-то у тебя с кодировкой там. Уверен что файл в utf-8?
an76
07.Февраль.2017 11:53:17
10
Действительно , спасибо за ответы