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

Compilation issues #10

Open
JayKickliter opened this issue Jul 30, 2016 · 2 comments
Open

Compilation issues #10

JayKickliter opened this issue Jul 30, 2016 · 2 comments

Comments

@JayKickliter
Copy link

JayKickliter commented Jul 30, 2016

I added copper line as a dependency in my Cargo.toml:

[dependencies]
copperline = "0.3.0"

But when I try to compile the example code:

extern crate copperline;

use copperline::Copperline;

fn main() {

    let cfg = copperline::Config {
        encoding: copperline::Encoding::Utf8,
        mode: copperline::EditMode::Vi
    };

    let mut cl = Copperline::new();
    while let Ok(line) = cl.read_line(">> ", &cfg) {
        println!("Line: {}", line);
        cl.add_history(line);
    }
}

I get these errors:

cargo build
   Compiling remnant v0.1.0 (file:///Users/jay/repos/remnant)
src/main.rs:55:15: 55:33 error: `copperline::Config` does not name a structure [E0422]
src/main.rs:55     let cfg = copperline::Config {
                             ^~~~~~~~~~~~~~~~~~
src/main.rs:55:15: 55:33 help: run `rustc --explain E0422` to see a detailed explanation
src/main.rs:57:15: 57:39 error: failed to resolve. Could not find `EditMode` in `copperline` [E0433]
src/main.rs:57         mode: copperline::EditMode::Vi
                             ^~~~~~~~~~~~~~~~~~~~~~~~
src/main.rs:57:15: 57:39 help: run `rustc --explain E0433` to see a detailed explanation
src/main.rs:61:46: 61:50 error: mismatched types:
 expected `copperline::Encoding`,
    found `&_`
(expected enum `copperline::Encoding`,
    found &-ptr) [E0308]
src/main.rs:61     while let Ok(line) = cl.read_line(">> ", &cfg) {
                                                            ^~~~
src/main.rs:61:46: 61:50 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error
error: Could not compile `remnant`.

Am I somehow getting an older version of the library despite specifying 0.3.0? Without any git tags or knowledge of how cargo publishing works, I can't figure out what git commit 0.3.0 is supposed point to.

@hjr3
Copy link

hjr3 commented Aug 2, 2016

@JayKickliter the 0.3.0 version is from October and it looks like a lot has changed. Use a specific git revision in your Cargo.toml file. I used the current revision of master:

[dependencies]
copperline = { git = "https://github.com/srijs/rust-copperline", rev = "5c12bbe" }

@srijs
Copy link
Owner

srijs commented Aug 6, 2016

Hi! I haven't been able to release the new version yet, since there is a bug with CJK unicode characters (#1) that I need to fix first.

If you don't require support for CJK characters and would like to take advantage of the new feature, feel free to use the current git version.

If you would like to use the version which is currently on crates.io (0.3.0), you can follow this example code: https://github.com/srijs/rust-copperline/blob/d88df7e1ff4a9999bce68d7ec873d3ec2d743e52/examples/simple.rs

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

3 participants