fortran 错误:错误 1 error LNK2019: 无法解析的外部符号 _ENGOPEN,该符号在函数 _MAIN__ 中被引用

C#include "fintrf.h"
C#if 0
C
C fengdemo.F
C .F file need to be preprocessed to generate .for equivalent
C#endif
C
C fengdemo.f
C
C This is a simple program that illustrates how to call the MATLAB
C Engine functions from a FORTRAN program.
C
C Copyright 1984-2005 The MathWorks, Inc.
C======================================================================
C $Revision: 1.9.4.4 $

program main
C-----------------------------------------------------------------------
C (pointer) Replace integer by integer*8 on 64-bit platforms
C
c mwpointer engOpen, engGetVariable, mxCreateDoubleMatrix
c mwpointer mxGetPr
c mwpointer ep, T, D
C----------------------------------------------------------------------
C
C Other variable declarations here
double precision time(10), dist(10)
integer engPutVariable, engEvalString, engClose
integer temp, status
data time / 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 /
C
ep = engOpen('matlab ')
C
end
没人懂吗??

你好,我也遇到过这个问题,刚刚解决了。出错的原因在于你写subroutine的时候,有一些引用的参数,而你在CALL 这个SUBROUTINE时,参数与子程序写的参数不统一,如:
CALL CONSTRUCT_X(Mloc,Mloc1,Nloc,DX,U,DelxU,UxL,UxR,Kappa)
。。。。。。
SUBROUTINE CONSTRUCT_X(M,M1,N,DX,Vin,Din,OutL,OutR,Kappa,D2X)
我的是这样的,subroutine里加了一个变量D2X,而call 时没有对应修改,所以出错,直接把call语句修改一下就ok了,改成:
CALL CONSTRUCT_X(Mloc,Mloc1,Nloc,DX,U,DelxU,UxL,UxR,Kappa,D2X)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-09-14
您需要把 matlab 相关的几个 lib 文件添加到工程中。或者设置链接参数,将 lib 文件添加到链接的输入中。追问



不行啊??

用的是intel fortran2011+visual studio 2008

第2个回答  2015-01-21
你子程序的名字和主程序中调用的子程序名称不一样。。

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网