Skip to content

Initial scaffold doesn't build #37

@AphonicChaos

Description

@AphonicChaos

Description

The out-of-box experience with Amethyst tools is suboptimal due to the generated application not working properly. I was following the steps from the book and failed to get the Hello World example to work. I then tried to make a new project without changing the contents of src/main.rs which yielded the results produced in this report.

Steps to reproduce

  1. Create a new project:
$ amethyst new hello_world
  1. Move into that project and attempt to run:
$ cd hello_world
$ amethyst run

Expected result

I'd expect to see the result of having run the program. I've never used amethyst before, But I suspect the output should look something like this:

$ amethyst run
Game started!
Hello from Amethyst!
Game stopped!

Actual Result

error[E0432]: unresolved import `amethyst::engine::Application`
 --> src/main.rs:3:24
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                        ^^^^^^^^^^^ no `Application` in `engine`

error[E0432]: unresolved import `amethyst::engine::Duration`
 --> src/main.rs:3:37
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                                     ^^^^^^^^ no `Duration` in `engine`

error[E0432]: unresolved import `amethyst::engine::State`
 --> src/main.rs:3:47
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                                               ^^^^^ no `State` in `engine`. Did you mean to use `state`?

error[E0432]: unresolved import `amethyst::engine::Trans`
 --> src/main.rs:3:54
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                                                      ^^^^^ no `Trans` in `engine`

error: module `engine` is private
 --> src/main.rs:3:24
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                        ^^^^^^^^^^^

error: module `engine` is private
 --> src/main.rs:3:37
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                                     ^^^^^^^^

error: module `engine` is private
 --> src/main.rs:3:47
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                                               ^^^^^

error: module `engine` is private
 --> src/main.rs:3:54
  |
3 | use amethyst::engine::{Application, Duration, State, Trans};
  |                                                      ^^^^^

error: cannot continue compilation due to previous error

error: Could not compile `hello_world`.

To learn more, run the command again with --verbose.
Error: Cargo task failed!

System information

$ rustc --version
rustc 1.17.0
$ amethyst --version
amethyst_cli 0.4.0
$ cargo --version
cargo 0.18.0 (fe7b0cdc 2017-04-24)
$ uname -a
Linux vapor 4.10.11-1-ARCH #1 SMP PREEMPT Tue Apr 18 08:39:42 CEST 2017 x86_64 GNU/Linux

Here is the contents of the src/main.rs file that the new command generated:

extern crate amethyst;

use amethyst::engine::{Application, Duration, State, Trans};

struct HelloWorld;

impl State for HelloWorld {
    fn on_start(&mut self) {
        println!("Game started!");
    }

    fn update(&mut self, _delta: Duration) -> Trans {
        println!("Hello from Amethyst!");
        Trans::Quit
    }

    fn on_stop(&mut self) {
        println!("Game stopped!");
    }
}

fn main() {
    let mut game = Application::new(HelloWorld);
    game.run();
}

Note that it's different than what the tutorial asks me to input. I was getting a different (though similar) set of errors, so wanted to do the minimal amount of work for a reproducible case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions