回 帖 发 新 帖 刷新版面

主题:近来看一下,C语言与Win32下汇编模块引用的问题!

C的代码如下是一个模块,
#include<stdio.h>
extern int swap(int,int);
void main()
{
    int a,b,c;
    printf("&Ecirc;&auml;&Egrave;&euml;a,b:");
    scanf("%d%d",&a,&b);
    swap(a,b);
    printf("a,b&micro;&Auml;&Ouml;&micro;&Icirc;&ordf;:%d %d\n",a,b);
}
汇编模块如下:,
.386
.model flat,stdcall
option casemap:none
;-------------------------------------------
includelib msvcrt.lib
printf proto C :sbyte,:vararg
;define header file(include)


.code

_swap proc argu_1:word,argu_2:word
           
           mov ax,argu_1
           mov bx,argu_2
           mov argu_1,bx
           mov argu_2,ax
           ret
_swap endp

           
end            
----------------------------------------------------------------------------
Linking...
LINK : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
main.obj : error LNK2001: unresolved external symbol "int __cdecl swap(int,int)" (?swap@@YAHHH@Z)
Debug/1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

1.exe - 2 error(s), 1 warning(s)



回复列表 (共1个回复)

沙发

[b]我的调试环境是VC6.0![/b]

我来回复

您尚未登录,请登录后再回复。点此登录或注册