gpt4 book ai didi

c++ - ASM 代码中对 C++ 变量的 undefined reference

转载 作者:行者123 更新时间:2023-11-30 02:44:52 24 4
gpt4 key购买 nike

<分区>

我正在尝试在 C++ 文件中编译以下 asm 代码,但好像 GCC 找不到 asm 部分中使用的变量。

DWORD d_eaxSave, d_ebxSave, d_ecxSave, d_edxSave, d_esiSave, d_ediSave, d_espSave, d_ebpSave;

#define ASM_UNPREFIXED_INTEL_START ".intel_syntax noprefix\n\t"
#define SAVE_REGISTERS() __asm__ (ASM_UNPREFIXED_INTEL_START \
"mov d_eaxSave, eax\n\t" \
"mov d_ebxSave, ebx\n\t" \
"mov d_ecxSave, ecx\n\t" \
"mov d_edxSave, edx\n\t" \
"mov d_esiSave, esi\n\t" \
"mov d_ediSave, edi\n\t" \
"mov d_espSave, esp\n\t" \
"mov d_ebpSave, ebp");

但是当我尝试编译时,GCC 给我以下错误:

undefined reference to `d_eaxSave'
undefined reference to `d_ebxSave'
undefined reference to `d_ecxSave'
undefined reference to `d_edxSave'
undefined reference to `d_esiSave'
undefined reference to `d_ediSave'
undefined reference to `d_espSave'
undefined reference to `d_ebpSave'

请问我该怎么做才能消除这些错误?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com