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

Issues with link_resource #361

Open
Opayne93 opened this issue May 21, 2024 · 1 comment
Open

Issues with link_resource #361

Opayne93 opened this issue May 21, 2024 · 1 comment

Comments

@Opayne93
Copy link

I am following the Roguelike tutorial and am trying to make use of an REX file. Code is below:

use bracket_lib::prelude::{embedded_resource, link_resource, XpFile};

embedded_resource!(SMALL_DUNGEON, "../resources/desert.xp");
pub struct RexAssets {
    pub menu: XpFile
}

impl RexAssets {
    pub fn new() -> RexAssets {
        link_resource!(SMALL_DUNGEON, "../resources/desert.xp");

        RexAssets {
            menu: XpFile::from_resource("../resources/desert.xp").unwrap()
        }
    }
}

I am getting this build error:

error[E0425]: cannot find value `EMBED` in this scope
  --> src/rex_assets.rs:10:9
   |
10 |         link_resource!(SMALL_DUNGEON, "../resources/desert.xp");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
   = note: this error originates in the macro `link_resource` (in Nightly builds, run with -Z macro-backtrace for more info)

Any ideas why I would be getting this? Peeking at the source code for link_resource, I see a reference to EMBED, but I don't know anything about macros, so I'm not sure what it's referencing or what it is trying to do.

I am on a M1 Macbook running rustc version 1.77.1

@Opayne93
Copy link
Author

Opayne93 commented May 22, 2024

Update: I was able to resolve this issue by adding bracket-embedding to my build, and by importing bracket-embedding::prelude::* in the file where I am utilizing the macro. Is it expected behavior that this additional dependency is required?

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

No branches or pull requests

1 participant