0

I'm trying to import an external crate in a simple hello world application.

In the main.rs, it was wrote

use rustdds::*;
fn main() {
    println!("Hello, world!");
}

cargo build then errors with

user@xxx:~/Documents/dds_test:$ cargo build
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling num-iter v0.1.42
   Compiling mio-extras v2.0.6
   Compiling rand v0.7.3
error: linking with `cc` failed: exit status: 1

I had already added the line rustdds = "0.4.8" below [dependencies] in Cargo.toml:

[dependencies]
rustdds = "0.4.8"

How could this be fixed?

Btw, I checked my gcc --version and it was the latest version. I also tried to download the crate's source project and cargo build the downloaded project and everything was fine.

xc wang
  • 318
  • 1
  • 3
  • 14

1 Answers1

0

Figured out the reason finally that my Rust version was not the latest.

Solution is to update rustup, i.e.,

rustup update
xc wang
  • 318
  • 1
  • 3
  • 14