Re: Fortran Error Problem
- From: "David Flower" <DavJFlower@xxxxxxx>
- Date: 28 Nov 2006 00:15:50 -0800
On Nov 28, 6:10 am, engrzi...@xxxxxxxxx wrote:
Plz give me advice... at engr_zi...@xxxxxxxxx
ERROR IS :
Compiling Fortran...
C:\MSDEV\Projects\truss\Text1.f90
Linking...
Text1.obj : error LNK2001: unresolved external symbol _X@4
Debug/Text1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Text1.exe - 2 error(s), 0 warning(s)
======================================
On Nov 27, 10:07 pm, engrzi...@xxxxxxxxx wrote:
I am new user of fortran. Trying it first time . Infact to make some
change in code of optimization of 10 bar truss. elimitated 70 errors
but the last one is not eliminated. So i cant run the code i have. Can
anybody help me to run this code. THX.. do email me on
[engr_zi...@xxxxxxxxx[ .
==================
! Program for 10 bar truss optimization yet under process of debugging
by Zia !
REAL, DIMENSION(8) :: P
REAL, DIMENSION(8,8) :: A
REAL, DIMENSION(8,8) :: U
REAL, DIMENSION(10) :: STRS
REAL, DIMENSION(10) :: PENALTY
REAL, DIMENSION(8) :: D
Ps=X(1)+X(2)+X(3)+X(4)+X(5)+X(6)+SQRT(2.)*(X(7)+X(8)+X(9)+X(10))
RL=360.
RHO=0.1
VALUE=RHO*RL*Ps
OBJ=VALUE
! DEFINE CONSTRAINTS
P(1)=0.
P(2)=0.
P(3)=0.
P(4)=0.
P(5)=0.
P(6)=100000.
P(7)=0.
P(8)=100000.
PAR=2.*DSQRT(2.D0)
A(1,1)=X(1)+X(2)+(X(8)+X(9))/PAR
A(1,2)=(-X(8)+X(9))/PAR
A(1,3)=-X(2)
A(1,4)=0.
A(1,5)=-X(9)/PAR
A(1,6)=A(1,5)
A(1,7)=0.
A(1,8)=0.
A(2,2)=X(5)+(X(8)+X(9))/PAR
A(2,3)=0.
A(2,4)=0.
A(2,5)=A(1,5)
A(2,6)=A(1,5)
A(2,7)=0.
A(2,8)=-X(5)
A(3,3)=X(2)+X(10)/PAR
A(3,4)=-X(10)/PA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)=D(5)-D(7)
STRS(5)=D(8)-D(2)
STRS(6)=D(6)-D(4)
STRS(7)=(D(7)+D(8))/2.
STRS(8)=(D(1)-D(2))/2.
STRS(9)=((D(5)+D(6))-(D(1)+D(2)))/2.
STRS(10)=((D(3)-D(4))-(D(7)-D(8)))/2.
DO I=1,10
STRS(I)=STRS(I)*EMOD/RL
ENDDO
PENALTY(1)=ABS(STRS(1))/25000.-1.
PENALTY(2)=ABS(STRS(2))/25000.-1.
PENALTY(3)=ABS(STRS(3))/25000.-1.
PENALTY(4)=ABS(STRS(4))/25000.-1.
PENALTY(5)=ABS(STRS(5))/25000.-1.
PENALTY(6)=ABS(STRS(6))/25000.-1.
PENALTY(7)=ABS(STRS(7))/25000.-1.
PENALTY(8)=ABS(STRS(8))/25000.-1.
PENALTY(9)=ABS(STRS(9))/75000.-1.
PENALTY(10)=ABS(STRS(10))/25000.-1.
STOP
END- Hide quoted text -- Show quoted text -
The other posters have got it right, but maybe a little more
explanation would help.
Your program references X(9) etc. From the line containing the
reference to X(9), the compiler cannot tell whether it is:
1) The 9th element of the array X or
2) A reference to an external function X
The way it decides is to look for the type statement associated with X.
If the type statement assigns (a) dimension(s) to X, then the compiler
knows X is an array.
Otherwise, including no type statement, when X defaults to REAL, X is
assumed to be an external FUNCTION.
Hope this helps
Dave Flower
.
- Follow-Ups:
- Re: Fortran Error Problem
- From: Richard Maine
- Re: Fortran Error Problem
- References:
- Fortran Error Problem
- From: engrzia76
- Re: Fortran Error Problem
- From: engrzia76
- Fortran Error Problem
- Prev by Date: Re: Fortran Error Problem
- Next by Date: Re: How to assign a=b=c=2 in fortran in one statement
- Previous by thread: Re: Fortran Error Problem
- Next by thread: Re: Fortran Error Problem
- Index(es):
Relevant Pages
|