Is Isahc module compiling only on unix?

Hello,

I have some noob question as I just started learning programming.

I have build some app using Isahc crate on my Linux VM and it works great. I wanted to test it on my Windows PC, so I made exec's... but there I have just cmd window flashing and nothing.

When I try to cargo run this program on Windows I have error:

Compiling isahc v0.9.12
error: attributes are not yet allowed on `if` expressions
   --> C:\Users\xxx\.cargo\registry\src\github.com-1ecc6299db9ec823\isahc-0.9.12\src\config\dial.rs:137:9
    |
137 |         #[cfg(unix)]
    |         ^^^^^^^^^^^^

error: aborting due to previous error

Is it possible that this module will not work on windows? I must use some other HTTP client?

It seems you're using some old version of the rust toolchain. What does cargo --version prints on your terminal?

Thank you Hyeonu.

cargo 1.41.0 (626f0f40e 2019-12-03)

and on rustup loolchain list on windows:
PS C:\Users\xxx\Documents\Rust\async-tungstenite\examples> rustup toolchain list
stable-i686-pc-windows-msvc
stable-x86_64-pc-windows-gnu
nightly-2018-12-06-i686-pc-windows-msvc
nightly-i686-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default)

Right, it's the feature implemented after the 2019-12-03. Below code doesn't compiles on the Rust 1.41.0 while compiles fine on 1.47.0 which is the latest stable release ATM.

fn main() {
    #[cfg(unix)]
    if true { println!("foo"); }
}

How did you installed the Rust toolchain on your machine? The recommended way is to use the rustup. Versions distributed by the platform package managers are commonly outdated a lot.

Since your answer seems to indicate you have rustup installed, I would be surprised if you haven’t called rustup update yet this year.

Well you should still try if calling rustup update is all that’s needed and solves your problem. [If your unsure about how to interpret the output of rustup update, feel free to post it here.] In case it doesn’t indicate any problems and rustup update also mentions that it has installed and up-to-date version of Rust (or such a version is already installed), the next thing to check would be if the cargo in your path is the one that rustup manages.

Execute where cargo to find out which cargo.exe you are actually executing. On my Windows machine the path is C:\Users\[my username]\.cargo\bin\cargo.exe. If yours is different that information might help us solving your problem.