Error de "directiva de caja esperada" sobre óxido

Editor's note: This question was asked before Rust 1.0 was released and the syntax, error messages, and even how crates are bundled have changed since then.

i wrote a rust example program. code is this:

use std;
import std::io;
fn main() {
    io::println("hello world");
}

i try to compile it, but the rustc compile tell me some error message .

hello.rc:4:0: 4:2 error: expected crate directive
hello.rc:4 fn main() {
       ^~

my rustc version is

macmatoMacBook-Air:test kula$ rustc -v
rustc 0.1.1 (a0f0a70 2012-03-10 00:35:02 -0800)
host: x86_64-apple-darwin

and my os is mac osx 10.7

anyone know what happened? i think my rust code has no problem on it.

preguntado el 10 de marzo de 12 a las 10:03

1 Respuestas

The compiler is trying to be smart and behaves differently for .rs (source) and .rc (crate) files.

Try again with a .rs file extension! :)

respondido 10 mar '12, 10:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.