I reported an error while compiling Rocket projects. The compiler told me that the crate "time-macros" had failed to link to "x86_64-w64-mingw32-gcc". The detailed error log report is that multiple files under ".rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib "cannot be found. For example, files such as "rsbegine. o" and "symbols.o" cannot be found. However, before "time-macros", several crates had been compiled successfully, why did it fail to compile to this crate? This is too strange, and I would be grateful if any Rust bosses who are familiar with Rocket could help me find a solution.
You may have incompatible version of MinGW. Proc macros are loaded into the compiler, so I suspect they are very sensitive about compatibility with the host compiler build.
Do you have to use mingw? The Visual Studio target
x86_64-pc-windows-msvc works much better.
As the author of
time-macros, there's no way this error is in any way related to the crate. It's just an ordinary proc macro.
Thank you very much for your advice, I changed to msvc after the success, my Windows did not install msvc before only MinGW, the reason for not using msvc is that I do not like to install VS on the computer, but now it seems that I have to do so, do you know why MinGW will fail to compile?
If you are in a Windows environment and both Visual Studio C++ Build tools and MinGW are required, any absence of either one will cause environmental issues.