MSVC11 错误中的 x64 位 asm
x64 bit asm in MSVC11 error
所以我的解决方案中有两个文件。
测试.asm
.code
test proc
mov eax, 1
ret
test endp
end
和
资料来源.cpp
#include <iostream>
#include <conio.h>
extern "C" int test();
int main()
{
std::cout << "eax = " << test() << std::endl;
_getch();
return 0;
}
我在配置管理器中将解决方案平台设置为 x64,并在构建自定义中检查了 masm。我找到了两个相关的帖子,但建议没有帮助。我正在YouTube上关注一个视频,并且完全按照作者的方式做了,但是我遇到了这些错误:
1>Source.obj : error LNK2019: unresolved external symbol _test referenced in function main
1>C:UsersomarDesktopASMx64DebugASM.exe : fatal error LNK1120: 1 unresolved externals
有人可以帮助我找出问题所在吗?我真的很想进入 x64 汇编。谢谢
你的汇编程序的函数名称必须是_test
的,而不仅仅是test
。您可以在链接器的错误消息中看到这一点:
error LNK2019: unresolved external symbol _test
/
||
right here ---------------------------------
有关更多详细信息,请参阅 Microsoft 窗口中的 C 名称修饰。
假设你在Visual studio上,你需要将程序集文件的名称添加到其他依赖项中。
- 右键单击项目
- 转到属性
- 点击链接器
- 点击输入
- 在其他依赖项中,添加测试
假设汇编代码工作正常,并且它与c ++源文件位于同一目录中,它应该可以工作
固定。跟着这个
另外,我不得不使用下划线
相关文章:
- 为x86而非x64编译时出错
- 为什么在 x64 中忽略__stdcall调用约定?
- 使用C++获取程序的 ASM
- 使用 VS2015 在 Windows 10 上构建 Fortran .lib x64 位并将其链接到 C++
- 加载"D:UsersPublicDocumentsopencvbuildx64vc14binopencv_world340d.dll",找不到或打开PDB文件
- VS 2017 使用交叉编译器构建 x64 项目
- 在VS2019项目中集成ImageMagick:x64-windows-static library
- C++变量在调用 x64 程序集函数后重置为 0
- 在 c++ 中使用 x86 DIV 的这个 asm 块有什么用?
- 在 masm x64 上打印具有多个参数
- 在Visual Studio中使用vcpkg使用paho-mqtt x64时出错
- 以 x64 配置访问证书公钥
- 发布代码的 gdb 堆栈跟踪可读性如何影响 x64?
- 将内联ASM转换为X64 igraph的固有
- MSVC11 错误中的 x64 位 asm
- 移植旧程序集(asm),使其在x64下编译
- 将浮点数组转换为整数的最佳方式.[替换x64的asm代码]
- 内联 ASM 到 x64 - 理解
- x64 asm如何设置指向_cdecl C函数的函数指针并调用它
- 有人能帮助将此asm代码转换为x64版的c++吗