Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing "use" in lib.rs with generated class at path #16

Closed
Zennii opened this issue Jun 17, 2021 · 11 comments · Fixed by #17
Closed

Missing "use" in lib.rs with generated class at path #16

Zennii opened this issue Jun 17, 2021 · 11 comments · Fixed by #17

Comments

@Zennii
Copy link

Zennii commented Jun 17, 2021

I ran ftw class chars/Player KinematicBody but when I tried to run the whole game (ftw run), Rust gave an error that it couldn't find player in handle.add_class::<player::Player>();. This seemed to be because the generated code added mod chars; to the top, but not use chars::*; or at least use chars::player; and I had to add it myself.

I'm using the released ftw 0.6.0

@macalimlim
Copy link
Owner

Hi @Zennii, thankyou for filing this issue. I will take a look at it this week.

@macalimlim
Copy link
Owner

Can you give me more details about your setup? Like godot-rust version, operating system, etc. Did you generate the project using ftw new <project>? Or using the cargo-generate template from a previous version? Thanks

@macalimlim
Copy link
Owner

I did some local testing and I did not get the same error. Please see the attached screenshot
ftw-github-issue-16

@macalimlim
Copy link
Owner

The ftw version I used in the screenshot above is the latest on the main branch. The next screenshot is the ftw version that is being distributed by crates.io
ftw-github-issue-16-p2

@macalimlim
Copy link
Owner

In both cases, I did not get the same error as you did, can you give me more details about your setup?

@Zennii
Copy link
Author

Zennii commented Jun 30, 2021

I did generate it using ftw new <project>, I'm using Windows 10, Cargo.toml says gdnative = "0.9.3", it happens every time I create a new class, I have to add the imports for every single class each time. If rust version helps: rustc 1.52.1 (9bc8c42bb 2021-05-09)

@Zennii
Copy link
Author

Zennii commented Jun 30, 2021

For example, creating a random class (chars/Playertt) just now:
image
Red shows the errors (Clion), it generates with incorrect pathing or missing necessary imports

use cams::mouse_cam_clipped;
use chars::{player, playertt};

@Zennii
Copy link
Author

Zennii commented Jun 30, 2021

image
I performed the same steps as one of your screenshots in powershell and it seems to have replicated the problem -- It couldn't have to do with my filepaths using # would it? I've run across programs that hate me for using symbols in my paths

@macalimlim
Copy link
Owner

@Zennii please see the PR for this issue

@Zennii
Copy link
Author

Zennii commented Jul 1, 2021

@macalimlim Looks like that branch fixes it for me as well! Thanks!

image

@macalimlim
Copy link
Owner

Great! I will do a release these coming days. Thanks again for filing this issue 👍🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants