We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
mainCRTStartup
Up
OS: Windows 10 rustc: rustc 1.32.0 (9fda7c223 2019-01-16) toolchain: stable-x86_64-pc-windows-msvc (default), nightly-x86_64-pc-windows-msvc c++构建工具: VS2017 Community
# cargo.toml [package] name = "blog_os" version = "0.1.0" authors = ["huangjj27 <huangjj.27@qq.com>"] edition = "2018" [profile.dev] panic = "abort" [profile.release] panic = "abort" [dependencies]
// main.rs #![no_std] #![no_main] use core::panic::PanicInfo; #[panic_handler] fn panic(_info: &PanicInfo) -> ! { loop {} } // 由于在Windows环境下编译, 故只摘抄Windows所需函数 #[no_mangle] pub extern "C" fn mainCRTStartUp() -> ! { main(); } #[no_mangle] pub extern "C" fn main() -> ! { loop {} }
error: linking with `link.exe` failed: exit code: 1120 | = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\34937\\Desktop\\learning-rust\\blog_os\\target\\debug\\deps\\blog_os-d19438c79a36ae28.4gg7n8zj6teng6ow.rcgu.o" "/OUT:C:\\Users\\34937\\Desktop\\learning-rust\\blog_os\\target\\debug\\deps\\blog_os-d19438c79a36ae28.exe" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\34937\\Desktop\\learning-rust\\blog_os\\target\\debug\\deps" "/LIBPATH:C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-78a7055b7313c664.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-b9ee21a1be63ac89.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-82c426bab9a155a3.rlib" = note: Non-UTF-8 output: LINK : error LNK2001: \xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xb7\xfb\xba\xc5 mainCRTStartup\r\nC:\\Users\\34937\\Desktop\\learning-rust\\blog_os\\target\\debug\\deps\\blog_os-d19438c79a36ae28.exe : fatal error LNK1120: 1 \xb8\xf6\xce\xde\xb7\xa8\xbd\xe2\xce\xf6\xb5\xc4\xcd\xe2\xb2\xbf\xc3\xfc\xc1\xee\r\n error: aborting due to previous error error: Could not compile `blog_os`. To learn more, run the command again with --verbose.
错误信息出现原因请参考: https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2001?view=vs-2017
另外找到了 可能 类似的rust连接c问题rust-lang/rust#31233 https://stackoverflow.com/questions/40548334/rust-code-cannot-link-with-a-c-library-compiled-on-windows-because-there-is-an-u
The text was updated successfully, but these errors were encountered:
该出错由于mainCRTStartup函数错写成了mainCRTStartUp函数, U字母误大写. 问题已经解决
mainCRTStartUp
U
Sorry, something went wrong.
Ok
No branches or pull requests
环境信息
OS: Windows 10
rustc: rustc 1.32.0 (9fda7c223 2019-01-16)
toolchain: stable-x86_64-pc-windows-msvc (default), nightly-x86_64-pc-windows-msvc
c++构建工具: VS2017 Community
例程
报错信息
参考信息
错误信息出现原因请参考: https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2001?view=vs-2017
另外找到了 可能 类似的rust连接c问题rust-lang/rust#31233
https://stackoverflow.com/questions/40548334/rust-code-cannot-link-with-a-c-library-compiled-on-windows-because-there-is-an-u
The text was updated successfully, but these errors were encountered: