GithubHelp home page GithubHelp logo

build problem about tokio-modbus HOT 3 CLOSED

slowtec avatar slowtec commented on May 24, 2024
build problem

from tokio-modbus.

Comments (3)

deeptuuk avatar deeptuuk commented on May 24, 2024

This is my Cargo.toml

[package]
name = "test_modbus"
version = "0.1.0"
authors = ["root"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp", "server"] }

[features]
tcp = ["tokio-modbus/tcp"]
server = ["tokio-modbus/server"]

from tokio-modbus.

deeptuuk avatar deeptuuk commented on May 24, 2024

This is the error

root@zynq:~/test_modbus# cargo build --features "tcp server"
   Compiling test_modbus v0.1.0 (/root/test_modbus)
error[E0432]: unresolved import `futures`
 --> src/main.rs:4:9
  |
4 |     use futures::future;
  |         ^^^^^^^ use of undeclared type or module `futures`

error[E0433]: failed to resolve: use of undeclared type or module `tokio`
 --> src/main.rs:2:3
  |
2 | #[tokio::main]
  |   ^^^^^ use of undeclared type or module `tokio`

error[E0433]: failed to resolve: could not find `tcp` in `server`
  --> src/main.rs:34:17
   |
34 |         server::tcp::Server::new(socket_addr).serve(|| Ok(MbServer));
   |                 ^^^ could not find `tcp` in `server`

error[E0277]: `main` has invalid return type `impl std::future::Future`
 --> src/main.rs:3:24
  |
3 | pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination`
  |
  = help: consider using `()`, or a `Result`

error[E0752]: `main` function is not allowed to be `async`
 --> src/main.rs:3:1
  |
3 | pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` function is not allowed to be `async`

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0277, E0432, E0433, E0752.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `test_modbus`.

To learn more, run the command again with --verbose.

from tokio-modbus.

deeptuuk avatar deeptuuk commented on May 24, 2024

finally I solve the problem ,below

[dependencies]
tokio-modbus = "*"
tokio = { version = "*", features = ["full"]}
futures = "*"
[features]
tcp = ["tokio-modbus/tcp"]
server = ["tokio-modbus/tcp-server-unstable"]

from tokio-modbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.