【问题标题】:error A2008 when using winapi使用winapi时出现错误A2008
【发布时间】:2015-12-26 19:00:10
【问题描述】:

我正在学习 Dennis Yurichev 的“初学者倒车”一书。其中一个练习的代码如下:

.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc 
include \masm32\include\kernel32.inc 
includelib \masm32\lib\kernel32.lib 
include \masm32\include\user32.inc 
includelib \masm32\lib\user32.lib 


.data
    $SG3103 DB  '%d', 0aH, 00H
.code
main PROC
    push    0
    call    DWORD PTR __imp___time64
    push    edx
    push    eax
    push    OFFSET $SG3103 ; '%d'
    call    DWORD PTR __imp__printf
    add esp, 16
    xor eax, eax
    ret 0
main ENDP
END main 

但是,当我在 Visual Studio 2015 中运行它时,我收到以下错误:

1>Addtwo.asm(16): error A2006: undefined symbol : __imp___time64
1>Addtwo.asm(20): error A2006: undefined symbol : __imp__printf

【问题讨论】:

    标签: assembly masm masm32


    【解决方案1】:

    您必须包含 C 运行时库。使用 MASM32:

    include \masm32\include\msvcrt.inc
    includelib \masm32\lib\msvcrt.lib
    

    并删除第一个下划线:

    call DWORD PTR _imp__printf
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-14
      • 2018-02-11
      • 1970-01-01
      • 2019-11-12
      • 2021-06-18
      • 2014-05-30
      • 2019-05-17
      • 1970-01-01
      相关资源
      最近更新 更多