コード スニペットは次のとおりです。
.386
.model flat, stdcall
option casemap :none ; case sensitive
.nolist
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\include\fpu.inc
.list
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
angulo_deg DW 270
coseno DB 50 DUP(" "),0ah,0dh,0
sal1_1 DB "Medidas para el angulo 270 Grados",0
sal3 DB "Coseno: ",0
.code
Inicio:
; ANGULO DEG:
fclex
pushd 180 ;store the integer value of 180 on the stack
fidiv dword ptr angulo_deg ;divide the angle in degrees by 180
;-> ST(0)=angle in degrees/180
fldpi ;load the hard-coded value of π
;-> ST(0)=π, ST(1)=angle in degrees/180
fmul ;-> ST(0)=angle in degrees*π/180, => angle in radians
invoke FpuCos, 0,0, SRC1_FPU or ANG_DEG or DEST_FPU
invoke FpuFLtoA, 0,4, ADDR coseno, SRC1_FPU or SRC2_DIMM
invoke StdOut, ADDR coseno
invoke ExitProcess,0
End Inicio
次に、「ml /c /coff /Fl ejemplo1.asm」でコンパイルしましたが、エラーは発生しません。しかし、「link /subsystem:console ejemplo1」とリンクすると、次のようになります。
ejemplo1.obj : エラー LNK2001: 未解決の外部シンボル _FputoA@16
ejemplo1.obj : エラー LNK2001: 未解決の外部シンボル _FpuCos@12
ejemplo1.exe : 致命的なエラー LNK1120: 2 つの未解決の外部
何が問題なのかわからない。あなたが私を助けてくれることを願っています。どうもありがとう。