3

我试图编译新的托盘。

我运行命令:

货物运行 -- --dev --tmp

我在终端中收到此错误:

error[E0433]: failed to resolve: use of undeclared type or module `sp_std`
 --> pallets/template/src/lib.rs:7:5
  |
7 | use sp_std::vec::Vec;
  |     ^^^^^^ use of undeclared type or module `sp_std`

我在 cargo.toml 文件中添加了必要的代码:

[dev-dependencies]
sp-core = { default-features = false, version = '2.0.0' }
sp-io = { default-features = false, version = '2.0.0' }
sp-runtime = { default-features = false, version = '2.0.0' }
sp-std = { default-features = false, version = '2.0.0' }


[features]
default = ['std']
std = [
    'codec/std',
    'frame-support/std',
    'frame-system/std',
    'sp-std/std', 
]

我不确定为什么它不编译。

4

1 回答 1

2

您将其导入为[dev-dependencies]. 此依赖项用于测试,而不是主构建的一部分。您需要将其作为正常依赖项导入[dependencies]

[dependencies]
sp-std = { default-features = false, version = '2.0.0' }
于 2020-10-06T14:26:00.890 回答