2

我最近发现了一个非常有趣的库,叫做ExonumCRC

每次我尝试在 Windows 10 中编译简单的测试项目时,都会受到以下欢迎:

error: couldn't read "C:\\Users\\XXXXXX\\OUTDIR/crc16_constants.rs": The 
system cannot find the file specified. (os error 2)
 --> src\crc16.rs:8:1
  |
8 | include!(concat!(env!("OUT_DIR"), "/crc16_constants.rs"));
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Could not compile `crc`.

我试过设置out_dir但是没有帮助。该库中似乎有build.rs应该导出该文件的文件,但它在构建之前没有这样做。有人有同样的问题吗?

编辑1:

在评论点之后,我删除了OUT_DIR环境变量并更改了源中的字符串,似乎仍然存在问题。编译的输出如下:

error: environment variable `OUT_DIR` not defined
 --> crc16.rs:8:18
  |
8 | include!(concat!(env!("OUT_DIR"), "\\crc16_constants.rs"));
  |                  ^^^^^^^^^^^^^^^

error: couldn't read "0\\crc16_constants.rs": The system cannot find the file specified. (os error 2)
 --> crc16.rs:8:1
  |
8 | include!(concat!(env!("OUT_DIR"), "\\crc16_constants.rs"));
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Could not compile `crc`.
4

1 回答 1

1

正如评论中指出的那样,解决方案是简单地更新 Rust 并检查PATHold cargo.exe

于 2018-05-11T11:57:25.677 回答