Error With libc Even After Adding Dependency to Cargo.toml


#1

I want to get some code I’ve been working on compiling on Rust stable instead of nightly. I removed #![feature(libc)] and replaced it with a dependency on libc 0.2 in my cargo.toml, but when I run cargo build I still get the error use of unstable library feature 'libc': use 'libc' from crates.io (see issue #27783) despite seeing it compile libc.


#2

Did you add extern crate libc; to your lib.rs?


#3
src\lib.rs:1:1: 1:19 error: use of unstable library feature 'libc': use `libc` from crates.io (see issue #27783)
src\lib.rs:1 extern crate libc;

#4

And could you post your Cargo.toml? Also, how are you building?


#5

turns bright red

I’m an idiot. I accidentally put libc as a build dependency. Oops!