Beginner : Help with a mqtt example, getting LINK : fatal error LNK1181 error

Hi there,
I'm a complete beginner in rust and i can't figure out how to run an example here.
Running on windows for this, i created a project using

cargo new testmqtt --bin

I did add this to my toml file,

[dependencies]
mosquitto-client = "0.1.5"

But when doing cargo build or run, i'm getting

Updating crates.io index
Compiling mosquitto-client v0.1.5
Compiling testmqtt v0.1.0 (C:\Users\Pierre\rust\testmqtt)
error: linking with link.exe failed: exit code: 1181
|
= note: "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX64\x64\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\Users\Pierre\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" [...]
"C:\Users\Pierre\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-6c8df881cdc2afb2.rlib" "C:\Users\Pierre\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-f998976453a15b70.rlib" "mosquitto.lib" "c.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
= note: Non-UTF-8 output: LINK : fatal error LNK1181: impossible d'ouvrir le fichier en entr\xe9e 'mosquitto.lib'\r\n

which stands more or less for impossible to open mosquitto.lib file.
I suppose i have to add this lib file (i don't where to find it btw), but i can't figure out how.

Can please someone guide me on this ?
Regards,
Pierre

If you are using Windows 10 I suggest installing the Linux Subsystem for Windows and installing/using Rust from there.

I have been doing that without issue since I discovered Rust some months back.

Occasionally I try to build something using a Windows Rust installation but so far I have never managed to get anything to build.

Of course if you ever need to deliver actual Windows executables that is not a solution but for learning and experimenting it works very well.

Ty zicog for this tip about linux subsystem on Windows 10 even if i must admit i was more interested in creating a simple app on Windows.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.