Here is a glance of my main.rs
:
#![no_std]
#![no_main]
#[no_mangle]
pub extern "C" fn main(_argc: isize, _argv: *const *const u8) -> isize {
0
}
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
Also note that I have panic = "abort"
set in Cargo.toml
.
The error seems to be the linking process. Here is a glance of the compiler output:
error: linking with `link.exe` failed: exit code: 1120
|
= note: "[some_path]\\MSVC\\14.24.28314\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "[some_path]\\target\\debug\\deps\\program.3tqh3p0993sfz3qb.rcgu.o" "/OUT:[some_path]\\target\\debug\\deps\\program.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "/LIBPATH:[some_path]\\target\\debug\\deps" "/LIBPATH:[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-f256746e283311d5.rlib" "[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-1c74e9c554982673.rlib" "[some_path]\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-c86932987f7f705f.rlib"
= note: LINK : error LNK2001: unresolved external symbol mainCRTStartup
[some_path]\target\debug\deps\program.exe : fatal error LNK1120: 1 unresolved externals
error: aborting due to previous error
Note that I have the following installed already:
MSVC v142 build tools
Windows Universal C Runtime
Windows 10 SDK (18362)