Visual Studio的2015年C ++和汇编没有建设 [英] Visual studio 2015 c++ and assembly not building
问题描述
我最近想开始学习组装,但我一直有一些问题,建立我的项目建设。
I recently wanted to start learning assembly, but I have been having some problem setting up my project to build.
我想有是一个C ++和汇编的项目,但它目前没有工作。如下图所示我总成code构建就好了:
What I want to have is a C++ and assembly project, but it is currently not working. My assembly code shown below builds just fine:
ExitProcess PROTO
.data
.code
main proc
mov rax, 8
mov rcx, 0
call ExitProcess
main endp
end
但我一个CPP文件添加到我的项目的那一刻,我得到链接错误的负载:
but the moment I add a cpp file to my project I get a load of linker errors:
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 ==========
有谁知道什么是错我的设置,以及如何解决它?
Does anybody know what is wrong with my setup and how to fix it?
推荐答案
您要链接的C运行时(CRT)的一部分项目libary, MSVCRTD.LIB
。您还需要与库 vcruntimed.lib
和 ucrtd.lib
链接。前者是Visual Studio的2015年本身,而后者是沿Visual Studio中安装了Windows 10 SDK的一部分的一部分。通常情况下C ++项目使用这些库中自动链接,但显然你的项目设置不是。
You're linking your project with only part of the C runtime (CRT) libary, msvcrtd.lib
. You also need to link with the libraries vcruntimed.lib
and ucrtd.lib
. The former is part of Visual Studio 2015 itself while the later is part of the Windows 10 SDK that was installed along Visual Studio. Normally C++ projects automatically link with these libraries, but apparently your project is setup not to.
您可能会以下意味着一个旧版本的Visual Studio只需要一个CRT库文件链接的说明。这改变了由于的重构在CRT与Visual Studio 2015年。
You may be following instructions meant for an older version of Visual Studio which only required linking with one CRT library file. This changed due to a refactoring of the CRT with Visual Studio 2015.
这篇关于Visual Studio的2015年C ++和汇编没有建设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!