主题:FORTRAN/C++混合编程中字符串的传递问题
我想用 FORTRAN/C++ 混合编程(vc7 和 cvf6.5 ),其他数据类型都没有问题,
就是字符串,字符老是不能传递,不知道为什么???
请做过类似工作的解答一下,谢谢!
//progc.cpp
#include <stdio.h>
#include <stdlib.h>
extern "C" {int _stdcall FACT (int n,char *);}
main(){
char *string = "abc0" ;
FACT(7,string)
return 0;
}
C progf.f
INTEGER*4 FUNCTION Fact (n,zz)
INTEGER*4 n
character*10 zz
write(*,*)zz
write(*,*)n
END
编译过程及出错信息:
C:\Documents and Settings\lc>fl32 -c progf.f
Compaq Visual Fortran Optimizing Compiler Version 6.5
Copyright 2000 Compaq Computer Corp. All rights reserved.
progf.f
C:\Documents and Settings\lc>cl progc.cpp progf.obj
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
progc.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:progc.exe
progc.obj
progf.obj
progc.obj : error LNK2019: unresolved external symbol _FACT@8 referenced in func
tion _main
progc.exe : fatal error LNK1120: 1 unresolved externals