Open jamaas opened 5 months ago
Hi @jamaas. The name of the trait in the ode-solvers
crate is System
. This trait gets exported in the library file lib.rs so that you can use it with ode_solvers::System
. The compiler messages look like there is an additional letter o in the use Systemo
. Can you check that? If it is not the source of the error maybe you can provide the full code of your main.rs
file.
Thanks @tomtuamnuq. I thought the same but this is an exact copy of example code from Github. I'll do some digging and see what I find, and report back.
Thanks again @tomtuamnuq. That was indeed the problem and must have been done by me because original code does not have it. Ooops. Now I am getting this out of scope error .... Suggestions on how to fix this?
-- mode: compilation; default-directory: "~/research/rust/renevey/ode-solvers-main/" -- Compilation started at Tue Feb 6 15:03:24
cargo build
Compiling ode_solvers v0.4.0 (/home/jamaas/research/rust/renevey/ode-solvers-main)
error[E0412]: cannot find type Vector3 in this scope
--> src/dop_shared.rs:23:14 |
23 | type State = Vector3 |
^^^^^^^ not found in this scope |
---|
help: consider importing one of these items | 3 + use crate::Vector3; |
---|
3 + use nalgebra::Vector3; |
error[E0782]: trait objects must include the dyn keyword
--> src/dop_shared.rs:24:17 |
24 | type MySystem = System<Precision, State>; | ^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
help: add dyn
keyword before this trait
|
24 | type MySystem = dyn System<Precision, State>;
| +++
Some errors have detailed explanations: E0412, E0782.
For more information about an error, try rustc --explain E0412
.
error: could not compile ode_solvers
(lib) due to 2 previous errors
Compilation exited abnormally with code 101 at Tue Feb 6 15:03:25
Hi @jamaas,
For the first error, as suggested by the compiler, you need to bring Vector3 in scope. You can do that by importing it with use crate::Vector3;
which is a type alias for nalgebra's Vector3 or directly from nalgebra with use nalgebra::Vector3;
.
For the second error, System
is a trait. You need to define a structure for your system and then implement this trait. For instance (have a look here for an example):
struct MySystem {};
impl ode_solvers::System<f64, State> for MySystem {
...
}
Lastly, your logs suggest that you are editing dop_shared.rs
. I don't know what you are trying to achieve but you might be better off trying to modify one of the examples.
I hope that helps.
Hi @srenevey et. al, sincerely appreciate your help and particularly your time.
I downloaded a fresh un-hacked copy and then attempted to use Cargo, from within Emacs, on Linux to build and then test the boucing_ball.rs file. I'll attach the output I got from both the build and test operations. It appears to compile but does not appear to produce an executable file that I can then run. In my ignorance, am I doing something wrong? Should it not produce a standalone executable file? Do I need to change or adjust my base Rust compiler setup? Why do I get so many errors when running a test? Thanks a bunch. J cargo_test_output.txt first_build_output.txt
I did some more reading and learned more about Cargo. As usual was making the initial attempt much more complicated than was necessary! I cloned a new version and followed the Cargo book instructions and it all works fine .... with one tiny exception. When you created the directory/file structure for the project you did not include a ./outputs directory, so the examples have nowhere to put results and throw an error. Might you want to include an empty directory? Would anyone like to help me, or know anyone who would like to help me, build the attached model in Rust?
Thanks a bunch, J.
Relative noob to Rust here, but lots of experience with other languages. My goal is to build a simple generic two-pool compartmental model using Rust and ode's. I found your ode models and they look perfect except there is something wrong with my Rust setup. When I attempt to compile the bouncing ball example I get these errors. Any/all suggestions most welcome, genuine thanks for your patience.
Systemo
in crateode_solvers
--> jambounc/src/main.rs:72:19System
::: /home/jamaas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ode_solvers-0.4.0/src/dop_shared.rs:25:1 | 25 | pub trait System<T, V> | ---------------------- similarly named trait
System
defined here