POe Decentralise App - Use of eundeclared type or module sp/std

190 views Asked by At

I trying to compile the new pallet.

I run the command:

cargo run -- --dev --tmp

And I get this error in my terminal:

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`

I have added the necessary code in the cargo.toml file:

[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', 
]

I am not sure why it isn't compiling.

1

There are 1 answers

0
Ricardo Rius On BEST ANSWER

You are importing it as [dev-dependencies]. This dependencies are used for tests and aren't part of the main build. You need to import it as a normal dependency [dependencies]

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