无法找到gl crate

时间:2015-01-24 04:16:51

标签: rust

我按照here的说明操作。在示例文件夹中,我使用first示例。出于某种原因,控制台说它无法找到外部箱子" gl"。这就是我的Cargo.toml的样子。

[package]

name = "hello_world"
version = "0.0.1"
authors = [ "bob <bobbuilder@gmail.com>" ]



[dependencies.gl]
git = "https://github.com/bjz/gl-rs"

[dependencies.glfw]
git = "https://github.com/bjz/glfw-rs.git"

[build-dependencies]
gl_generator = "*"

[dependencies]
gl_common = "*"

[[bin]]

name = "hello_world"

我的build.rs

extern crate gl_generator;    // <-- this is your build dependency
extern crate khronos_api;    // included by gl_generator

use std::os;
use std::io::File;

fn main() {
let dest = Path::new(os::getenv("OUT_DIR").unwrap());

let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap();

// This generates bindsings for OpenGL ES v3.1
gl_generator::generate_bindings(gl_generator::GlobalGenerator,
                                gl_generator::registry::Ns::Gles2,
                                khronos_api::GL_XML,
                                vec![],
                                "3.1", "core", &mut file).unwrap();
}

1 个答案:

答案 0 :(得分:0)

您链接的文档说:

  

[package]部分下,添加build = "build.rs"

但我在Cargo.toml中没有看到。