< 返回版块

根据官方教程调用自己写模块时提示“can't find crate for '...'"

Nostalgia 发表于

在根据这个文档学习时 https://kaisery.github.io/trpl-zh-cn/ch07-01-mod-and-the-filesystem.html https://kaisery.github.io/trpl-zh-cn/ch07-02-controlling-visibility-with-pub.html

在第二篇文章中加入 extern crate communicator; 后,在编译的时候提示如下: warning: custom registry support via the registry.index configuration is being removed, this functionality will not work in the future Compiling test2 v0.1.0 (file:///home/liuwenling/project/test2) error[E0463]: can't find crate for communicator --> src/main.rs:1:1 | 1 | extern crate communicator; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

error: Could not compile test2.

请问中间是不是漏掉了什么步骤??

评论区

LiuTongshuo 2018-04-04T11:53:54.383083

在 Cargo.toml [dependencies]

communicator = { path = "这里" }

#当前目录是 Cargo.toml 所在的目录 #path填 communicator 项目目录

LiuTongshuo 2018-04-04T11:55:44.127602

??格式发出来就没有了??

@LiuTongshuo 在 Cargo.toml [dependencies] communicator = { path = "这里" } #当前目录是 Cargo.toml 所在的目录 #path填 communicator 项目目录

漂流 2018-04-05T05:22:06.548508

markdown 格式,调整一下

@LiuTongshuo ??格式发出来就没有了??

@LiuTongshuo 在 Cargo.toml [dependencies] communicator = { path = "这里" } #当前目录是 Cargo.toml 所在的目录 #path填 communicator 项目目录

作者 Nostalgia 2018-04-08T17:33:16.579533

感谢,已经解决了~

@LiuTongshuo 在 Cargo.toml [dependencies] communicator = { path = "这里" } #当前目录是 Cargo.toml 所在的目录 #path填 communicator 项目目录

1 共 4 评论, 共 1 页