【问题标题】:The specified procedure could not be found. (os error 127) - #![plugin(rocket_codegen)]找不到指定的过程。 (操作系统错误 127) - #![plu​​gin(rocket_codegen)]
【发布时间】:2019-05-06 07:33:50
【问题描述】:

我是 Rust 编程的新手,我正在构建 Rust + Diesel + Rocket 框架。

当我运行命令cargo checkcargo run时,出现如下错误:

The specified procedure could not be found. (os error 127)
--> src\main.rs:2:11
|
2 | #![plugin(rocket_codegen)]

操作系统:Windows 10

cargo.toml

[package]
name = "rest_in_rust"
version = "0.1.0"
authors = ["venka"]

[dependencies]
diesel = { version = "1.0.0", features = ["postgres"]}
dotenv = "0.9.0"
r2d2 = "0.8.3"
serde = "1.0.80"
serde_derive = "1.0.80"
serde_json = "1.0.33"

rocket = {  git = "https://github.com/SergioBenitez/Rocket" }
rocket_codegen = {  git = "https://github.com/SergioBenitez/Rocket" }
rocket_contrib = {  git = "https://github.com/SergioBenitez/Rocket", default-features = false, features = ["json"] }

Rust 版本:rustc 1.32.0-nightly (0c999ed13 2018-12-03)

main.rs 文件(第 2 行向我抛出此错误)有什么线索吗?

 #![feature(plugin, custom_derive, const_fn, decl_macro)]
 #![plugin(rocket_codegen)]

 #[macro_use]
 extern crate diesel;
 extern crate dotenv;
 extern crate r2d2;
 extern crate rocket;
 extern crate rocket_contrib;
 #[macro_use]
 extern crate serde_derive;
 #[macro_use]
 extern crate serde_json;

 use dotenv::dotenv;
 use std::env;
 use diesel::prelude::*;
 use diesel::pg::PgConnection;

 mod schema;
 mod models;
 mod db;
 mod static_file;

【问题讨论】:

  • 请查看如何创建minimal reproducible example,然后查看edit 您的问题以包含它。我们无法判断代码中存在哪些模块等(例如schema)如果重现问题不需要这些,删除它们;如果需要,提供它们,并尽可能减少。尝试在一个全新的 Cargo 项目中用最少 所需的代码量来重现您的错误。还有Rust-specific MCVE tips

标签: rust rust-rocket


【解决方案1】:

我的 Cargo.toml

rocket = { git = "https://github.com/SergioBenitez/Rocket" }
rocket_codegen = { git = "https://github.com/SergioBenitez/Rocket" }

这将拉取最新版本。对我来说,它获得了 Rocket 0.4.0。从 Rocket 0.4 开始,rocket_codegen 不应成为直接依赖项。

只需删除它:

Cargo.toml

[dependencies]
rocket = "0.4"

ma​​in.rs

#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;

请在Rocket Documentation的新闻部分查看更改日志。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-31
    • 2020-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多