redox-os / orbtk-template

A template for starting an OrbTk project
MIT License
31 stars 7 forks source link

Not compiling due to cannot find in scope / failed to resolve errors #4

Open n8henrie opened 3 years ago

n8henrie commented 3 years ago

Thanks for your very quick help here.

Now on initial compile I'm getting a bunch of errors that seem likely related to import paths.

$ cargo run
    Updating git repository `https://github.com/redox-os/orbtk.git`
    Updating git repository `https://gitlab.redox-os.org/redox-os/dces-rust.git`
    Updating crates.io index
    Updating git repository `https://gitlab.redox-os.org/redox-os/dces-rust.git`
    Updating git repository `https://gitlab.redox-os.org/redox-os/orbclient.git`
   Compiling libc v0.2.86
   Compiling autocfg v1.0.1
...
...
...
   Compiling orbtk-template v0.1.0 (/Users/n8henrie/git/orbtk-template)
error[E0412]: cannot find type `ComponentBox` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::ComponentBox;
  |
1 | use orbtk::api::macros::ComponentBox;
  |

error[E0412]: cannot find type `SharedComponentBox` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::SharedComponentBox;
  |
1 | use orbtk::api::macros::SharedComponentBox;
  |

error[E0412]: cannot find type `Entity` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::Entity;
  |
1 | use orbtk::api::macros::Entity;
  |

error[E0405]: cannot find trait `Component` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::Component;
  |
1 | use orbtk::api::macros::Component;
  |

error[E0433]: failed to resolve: use of undeclared type `ComponentBox`
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::ComponentBox;
  |
1 | use orbtk::api::macros::ComponentBox;
  |

error[E0433]: failed to resolve: use of undeclared type `SharedComponentBox`
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::SharedComponentBox;
  |
1 | use orbtk::api::macros::SharedComponentBox;
  |

error[E0433]: failed to resolve: use of undeclared type `SharedComponentBox`
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::SharedComponentBox;
  |
1 | use orbtk::api::macros::SharedComponentBox;
  |

error[E0405]: cannot find trait `Component` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::Component;
  |
1 | use orbtk::api::macros::Component;
  |

error[E0433]: failed to resolve: use of undeclared type `ComponentBox`
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::ComponentBox;
  |
1 | use orbtk::api::macros::ComponentBox;
  |

error[E0433]: failed to resolve: use of undeclared type `SharedComponentBox`
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::SharedComponentBox;
  |
1 | use orbtk::api::macros::SharedComponentBox;
  |

error[E0433]: failed to resolve: use of undeclared type `SharedComponentBox`
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::SharedComponentBox;
  |
1 | use orbtk::api::macros::SharedComponentBox;
  |

error[E0412]: cannot find type `Entity` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::Entity;
  |
1 | use orbtk::api::macros::Entity;
  |

error[E0412]: cannot find type `Entity` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::Entity;
  |
1 | use orbtk::api::macros::Entity;
  |

error[E0412]: cannot find type `Entity` in this scope
 --> src/main_view.rs:5:1
  |
5 | / widget!(
6 | |     MainView<MainState> {
7 | |         title: String
8 | |     }
9 | | );
  | |__^ not found in this scope
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
  |
1 | use crate::behaviors::text_behavior::Entity;
  |
1 | use orbtk::api::macros::Entity;
  |

error[E0412]: cannot find type `Entity` in this scope
  --> src/main_view.rs:12:27
   |
12 |     fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
   |                           ^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
1  | use crate::behaviors::text_behavior::Entity;
   |
1  | use orbtk::api::macros::Entity;
   |

error: aborting due to 15 previous errors

Some errors have detailed explanations: E0405, E0412, E0433.
For more information about an error, try `rustc --explain E0405`.
error: could not compile `orbtk-template`

To learn more, run the command again with --verbose.
jgrussell commented 3 years ago

I am seeing the exact same behavior reported here both for this template repository code and the multi_window example from the main OrbTk repository.

The Minimal Example from the main OrbTk repository does still work.

All of this is with orbtk = { git = "https://github.com/redox-os/orbtk.git", branch= "develop" } in the [dependencies] section of Cargo.toml.

My entire rust environment is less than two weeks old, created with rustup on Ubuntu 18.04.3 LTS.

jgrussell commented 3 years ago

A quick and dirty fix for this is to add use orbtk::api::macros::*; at the top of the src/main_view.rs file.