[ dontoo @ 23.03.2010. 21:08 ] @
Imam jedan .asm file koji sadrži include direktivu na fajl io.h ( masm kod ) koji je već ima kompajlirani .obj fajl ( io.obj ). Kad u Visual Command Promptu upišem ml /c /coff mojprog.asm link /subsystem:console /entry:start /out:mojprog.exe mojprog.obj io.obj kernel32.lib dobijem izvršni program koji uredno radi. Ali kad želim napravit projekt u VS-u kod buildanja projekta dobije nekoliko grešaka u ovom io.h fajlu error LNK2001: unresolved external symbol atodproc error LNK2001: unresolved external symbol inproc error LNK2001: unresolved external symbol outproc....itd Evo koje sam korake poduzeo kod pravljenja projekta. 1. File -> New VC++ Empty Project, add new .asm file, add .h file, kopirao io.obj fajl u debug folder 2. U custom build rules odabrao masm 3. Console (/SUBSYSTEM:CONSOLE) Što još trebam podest da bi mogao kompajlirati program? main.asm Code: ; Example assembly language program -- adds two numbers ; Author: R. Detmer ; Date: revised 7/97; revised by jaj 11/11/09 .386 .model flat ExitProcess Proto Near32 StdCall, dwExitCode:DWord Include io.h cr equ 0dh Lf equ 0ah .stack 4096 .data number1 dword ? number2 dword ? sum dword ? prompt1 byte "Enter first number: ", 0 prompt2 byte "Enter second number: ", 0 string byte 40 Dup (?) sumis byte cr, Lf, "The sum is " sumch byte 11 Dup (?) byte cr, Lf, 0 .code _start: output prompt1 ; prompt for first number input string, 40 ; read ASCII characters atod string ; convert to integer mov number1, eax ; store in memory output prompt2 ; repeat for second number input string, 40 atod string mov number2, eax mov eax, number1 ; sum = number1 + number2 add eax, number2 mov sum, eax output sumis ; output message dtoa sumch, eax ; convert to ASCII characters output sumch invoke ExitProcess, 0 Public _start ; make entry point public end ; end of source code io.h Code: ; IO.H -- header file for I/O macros ; 32-bit version for flat memory model ; R. Detmer last revised 8/2000 .NOLIST ; turn off listing .386 EXTRN itoaproc:near32, atoiproc:near32 EXTRN dtoaproc:near32, atodproc:near32 EXTRN inproc:near32, outproc:near32 itoa MACRO dest,source,xtra ;; convert integer to ASCII string IFB <source> .ERR <missing operand(s) in ITOA> EXITM ENDIF IFNB <xtra> .ERR <extra operand(s) in ITOA> EXITM ENDIF push ebx ;; save EBX mov bx, source push bx ;; source parameter lea ebx,dest ;; destination address push ebx ;; destination parameter call itoaproc ;; call itoaproc(source,dest) pop ebx ;; restore EBX ENDM atoi MACRO source,xtra ;; convert ASCII string to integer in AX ;; offset of terminating character in ESI IFB <source> .ERR <missing operand in ATOI> EXITM ENDIF IFNB <xtra> .ERR <extra operand(s) in ATOI> EXITM ENDIF push ebx ;; save EBX lea ebx,source ;; source address to EBX push ebx ;; source parameter on stack call atoiproc ;; call atoiproc(source) pop ebx ;; parameter removed by ret ENDM dtoa MACRO dest,source,xtra ;; convert double to ASCII string IFB <source> .ERR <missing operand(s) in DTOA> EXITM ENDIF IFNB <xtra> .ERR <extra operand(s) in DTOA> EXITM ENDIF push ebx ;; save EBX mov ebx, source push ebx ;; source parameter lea ebx,dest ;; destination address push ebx ;; destination parameter call dtoaproc ;; call dtoaproc(source,dest) pop ebx ;; restore EBX ENDM atod MACRO source,xtra ;; convert ASCII string to integer in EAX ;; offset of terminating character in ESI IFB <source> .ERR <missing operand in ATOD> EXITM ENDIF IFNB <xtra> .ERR <extra operand(s) in ATOD> EXITM ENDIF lea eax,source ;; source address to EAX push eax ;; source parameter on stack call atodproc ;; call atodproc(source) ;; parameter removed by ret ENDM output MACRO string,xtra ;; display string IFB <string> .ERR <missing operand in OUTPUT> EXITM ENDIF IFNB <xtra> .ERR <extra operand(s) in OUTPUT> EXITM ENDIF push eax ;; save EAX lea eax,string ;; string address push eax ;; string parameter on stack call outproc ;; call outproc(string) pop eax ;; restore EAX ENDM input MACRO dest,length,xtra ;; read string from keyboard IFB <length> .ERR <missing operand(s) in INPUT> EXITM ENDIF IFNB <xtra> .ERR <extra operand(s) in INPUT> EXITM ENDIF push ebx ;; save EBX lea ebx,dest ;; destination address push ebx ;; dest parameter on stack mov ebx,length ;; length of buffer push ebx ;; length parameter on stack call inproc ;; call inproc(dest,length) pop ebx ;; restore EBX ENDM .NOLISTMACRO ; suppress macro expansion listings .LIST ; begin listing Dole je prikačen io.obj fajl |