【问题标题】:"entry point could not be located" when running program on Windows在 Windows 上运行程序时“找不到入口点”
【发布时间】:2015-04-13 22:31:15
【问题描述】:

我使用标准Regex crate 编写了一个程序来解析Rust 中的一些文件名。该程序在 Linux 上运行良好,但是当我尝试在 Windows 上编译和运行它时,我得到了某种 DLL 错误。我真的不明白这是怎么回事,但这就是我必须继续下去的全部内容。

这是我正在使用的编译器版本:

F:\Coding\rust-shutterstock-deduper\target (master)
λ rustc --version
rustc 1.0.0-nightly (3ef8ff1f8 2015-02-12 00:38:24 +0000)

这是我要运行的程序:

#![feature(plugin)]

#![plugin(regex_macros)]
extern crate regex_macros;
extern crate regex;

fn main() {
        let x = regex!(".*");
}

还有我的Cargo.toml 文件:

[package]

name = "my_package"
version = "0.0.1"
authors = ["Nate Mara <natemara@gmail.com>"]

[dependencies]
regex = "0.1.14"
regex_macros = "0.1.8"

是否有我应该传入的编译器标志,或者我需要以特殊方式运行它,或者......我在这里做错了什么?我只是在运行cargo run

【问题讨论】:

  • 我能够在 32 位 Windows 7 VM 上使用 rustc 1.0.0-nightly (3ef8ff1f8 2015-02-12 00:38:24 +0000) 编译和运行它。你应该减少你的程序,创建一个MCVE。一旦你减少了代码的大小,你还应该包括你的Cargo.toml,你是如何构建的,以及你是如何启动你的程序的。
  • @Shepmaster 刚刚编辑以显示这些详细信息。我正在尝试使用 32 位 rustc 和 32 位 gcc 构建 win8 x64。
  • 解决了!谢谢你。这样做的目的是什么?

标签: rust


【解决方案1】:

#[no_link] 添加到您的代码中:

#![plugin(regex_macros)]
#[no_link]
extern crate regex_macros;

现在,插件是 crates,这意味着它们会被链接。regex_macros crate 应该告诉您添加 no_link,但这是 Rust issue 的临时解决方法。但是,看起来这是在 process 中的 fixed

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-18
    • 2020-05-19
    • 1970-01-01
    • 2021-08-10
    • 2021-11-13
    • 1970-01-01
    相关资源
    最近更新 更多