You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用FASM 1.73.32时import32.inc出现else指令意外错误求助

FASM 1.73.32:"意外指令'else'"错误排查与解决

错误原因

出现该错误的核心原因有两种可能:

  • import语句写法不符合宏的预期:当你在import中写ExitProcess,'ExitProcess'这类label与API名称完全一致的条目时,会触发宏内的条件分支语法问题;
  • import32.inc中的宏存在语法缺陷:你提供的import宏代码片段显示else后代码不完整,大概率是宏内的if判断未正确闭合(缺少end if),导致FASM解析时识别到意外的else指令。

解决方法

方法1:简化import语句写法

对于label与API名称完全相同的条目,直接省略字符串参数,FASM会自动将label作为API名称使用。修改后的import代码如下:

import kernel32,\
       GetModuleHandle,'GetModuleHandleA',\
       ExitProcess,\
       FindFirstFile,'FindFirstFileA',\
       FindNextFile,'FindNextFileA',\
       FindClose

方法2:修复import32.inc中的宏语法

打开import32.inc,找到import宏,补充完整条件分支的闭合代码,确保if与end if正确配对。标准的宏代码应类似:

macro import name,[label,string]
 { common
    rb (- rva $) and 3
    if defined name#.referred
     name#.lookup:
   forward
     if used label
      if string eqtype ''
       local _label
       dd RVA _label
      else
       dd string
      end if
      label dd 0
   common
     dd 0
    end if
 }

内容的提问来源于stack exchange,提问作者Cătălin George Feștilă

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 03:06:00