main.asm
INCLUDE \masm32\include\Irvine32.inc
INCLUDELIB \masm32\lib\Irvine32.lib
INCLUDELIB \masm32\lib\kernel32.lib
INCLUDELIB \masm32\lib\user32.lib
EXTERN str_copy1@12:proc
.data
source byte 'rbh4rbjwirhklec',0
target byte lengthof source dup(0)
.code
main PROC
push 6
push offset source
push offset target
call str_copy1@12
exit
main ENDP
END main
copy.asm
INCLUDE \masm32\include\Irvine32.inc
INCLUDELIB \masm32\lib\Irvine32.lib
INCLUDELIB \masm32\lib\kernel32.lib
INCLUDELIB \masm32\lib\user32.lib
.code
str_copy1 PROC PUBLIC USES esi edi ecx eax,source:PTR BYTE,target:PTR BYTE,maxnum:DWORD
mov esi,source
mov edi,target
mov eax,0
@@while:
cmp byte ptr[esi],0
je @@end
inc eax
inc esi
jmp @@while
@@end:
inc eax
cmp maxnum,eax
jna l1
mov ecx,maxnum
l1:mov ecx,eax
clc
l2:movsb
inc esi
inc edi
loopd l2
ret
str_copy1 ENDP
END
编译无问题,一link,main.asm就unsolved extern symbol:_str_copy@12
copy.asm就unsolved extern symbol _maincrtstartup
请问怎么解决,谢谢
------解决方案--------------------------------------------------------
link 是也要将 copy.obj 加上的:link /subsystem:console main.obj copy.obj
总不能让 link 程序自己去寻找 str_copy 在哪个 obj 文件里吧,无从找起啊!