l1npengtul / nokhwa

Cross Platform Rust Library for Powerful Webcam/Camera Capture
Apache License 2.0
502 stars 121 forks source link

Error compiling #84

Closed SujithChristopher closed 1 year ago

SujithChristopher commented 1 year ago

I'm currently using rust 1.66, and I'm having this error, when I just add nokhwa in cargo.toml.

Compiling nokhwa-bindings-linux v0.1.0 Compiling nokhwa-bindings-macos v0.2.0 Compiling nokhwa-bindings-windows v0.4.0 Compiling nokhwa v0.10.2 Compiling rust_serial v0.1.0 (C:\Users\Sujith\Documents\Projects\rust_projects\rust_serial) error[E0432]: unresolved import nokhwa::CallbackCamera --> src\main.rs:14:5 | 14 | CallbackCamera, | ^^^^^^^^^^^^^^ no CallbackCamera in the root

This is my cargo.toml dependencies

[package] name = "rust_serial" version = "0.1.0" edition = "2021"

[dependencies] csv = "1.1.6" egui = "0.20.1" rand = "0.8.5"

[dependencies.nokhwa] version = "0.10.2" features = ["input-native", "output-wgpu"]

I'm relatively new to rust, so please help me out. Thanks.

l1npengtul commented 1 year ago

You forgot to enable the output-threaded cargo feature. Replace

[dependencies.nokhwa]
version = "0.10.2"
features = ["input-native", "output-wgpu"]

with

[dependencies.nokhwa]
version = "0.10.2"
features = ["input-native", "output-wgpu", "output-threaded"]