Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/ping build errors #3112

Closed
wvdji opened this issue Nov 13, 2022 · 5 comments
Closed

examples/ping build errors #3112

wvdji opened this issue Nov 13, 2022 · 5 comments

Comments

@wvdji
Copy link

wvdji commented Nov 13, 2022

error[E0432]: unresolved import libp2p::ping
--> src/main.rs:26:24
|
26 | use libp2p::{identity, ping, Multiaddr, PeerId};
| ^^^^ no ping in the root

error[E0432]: unresolved import libp2p_swarm
--> src/main.rs:27:5
|
27 | use libp2p_swarm::keep_alive;
| ^^^^^^^^^^^^ use of undeclared crate or module libp2p_swarm

error[E0433]: failed to resolve: use of undeclared crate or module async_std
--> src/main.rs:30:3
|
30 | #[async_std::main]
| ^^^^^^^^^ use of undeclared crate or module async_std

error[E0425]: cannot find function development_transport in crate libp2p
--> src/main.rs:36:29
|
36 | let transport = libp2p::development_transport(local_key).await?;
| ^^^^^^^^^^^^^^^^^^^^^ not found in libp2p

error[E0599]: no method named select_next_some found for struct Swarm in the current scope
--> src/main.rs:53:21
|
53 | match swarm.select_next_some().await {
| ^^^^^^^^^^^^^^^^ method not found in Swarm<Behaviour>

@umgefahren
Copy link
Contributor

Could you give a bit more context here? What exactly is the issue and could you give the complete code? From the first look of it you copy-and-pastet the ping example into a project of your own, but you forgot to enable the necessary features of libp2p and add the libp2p_swarm dependency.

@dariusc93
Copy link
Member

I agree with @umgefahren, Although the errors dont provide much context, it only make me assume you didnt have all of the dependencies apart of your project as well as having the features enabled in your Cargo.toml.

@thomaseizinger
Copy link
Contributor

Related: #3111

@wvdji
Copy link
Author

wvdji commented Nov 13, 2022

Sorry, I'm new to Rust. Problem solved.

@wvdji wvdji closed this as completed Nov 13, 2022
@umgefahren
Copy link
Contributor

No problem

Part of the problem might be the fact that the ping example uses libp2p_swarm instead of libp2p.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants