繁体   English   中英

Visual Studio 2015 c ++和程序集没有构建

[英]Visual studio 2015 c++ and assembly not building

我最近想开始学习汇编,但是我在构建我的项目时遇到了一些问题。

我想要的是一个C ++和汇编项目,但它目前无法正常工作。 下面显示的汇编代码构建得很好:

ExitProcess PROTO

.data

.code

main proc

    mov rax, 8

    mov rcx, 0
    call ExitProcess

main endp

end

但是当我向项目中添加一个cpp文件时,我得到一堆链接器错误:

void ToDo()
{
    int i = 0;
}

错误:

1>------ Build started: Project: AssemblyTest, Configuration: Debug x64 ------
1>  test.cpp
1>MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol _CrtDbgReport referenced in function _CRT_RTC_INIT
1>MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol _CrtDbgReportW referenced in function _CRT_RTC_INITW
1>MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __stdio_common_vsprintf_s referenced in function _vsprintf_s_l
1>MSVCRTD.lib(_error_.obj) : error LNK2001: unresolved external symbol __C_specific_handler
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol _wmakepath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol _wsplitpath_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol wcscpy_s referenced in function "int __cdecl GetPdbDllPathFromFilePath(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleFileNameW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __vcrt_GetModuleHandleW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
1>MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __vcrt_LoadLibraryExW referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)
1>C:\Users\***\Desktop\AssemblyTest\x64\Debug\AssemblyTest.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

有人知道我的设置有什么问题以及如何修复它?

您将项目与仅部分C运行时(CRT)库( msvcrtd.lib )链接起来。 您还需要链接库vcruntimed.libucrtd.lib 前者是Visual Studio 2015本身的一部分,而后者是Visual Studio中安装的Windows 10 SDK的一部分。 通常,C ++项目会自动链接到这些库,但显然您的项目设置不是。

您可能正在遵循针对旧版Visual Studio的说明,该版本仅需要链接到一个CRT库文件。 由于CRT与Visual Studio 2015的重构,这种情况发生了变化。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM