Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Hi.. I've a problem with my fortran project. It dosen't create a .exe and the errors are:...

DEBORA_P_
Beginner
2,583 Views

Hi.. I've a problem with my fortran project. It dosen't create a .exe and the errors are:

Error    18     error LNK2019: unresolved external symbol _COMPR_PT@172 referenced in function _MAIN__    main_curve_unita.obj    
Error    19     fatal error LNK1120: 1 unresolved externals    Release/main_curve_unita.exe    

I hope you could help me to find a solution

best regardes.

0 Kudos
6 Replies
KitturGanesh
Employee
2,583 Views

Hi Debora,
I'll transfer to the Fortran forum for immediate support and resolution thereof. Appreciate your patience accordingly.

Kittur

0 Kudos
TimP
Honored Contributor III
2,583 Views

As you don't say anything about how you got the .obj files nor which compilers you use, the error raises the suspicion that you may be mixing objects from different compilers or different settings of iface in ifort.

 I guess you refer to Windows which is the other Intel Fortran forum.

0 Kudos
Steven_L_Intel1
Employee
2,583 Views

The procedure COMPR_PT is either missing or you're calling it from the main program with the wrong number of arguments. That the name ends with @172 tells me that you have the project set up to use the STDCALL calling convention, which was the default of Compaq Visual Fortran but not of Intel Fortran. As long as all of the program is compiled with the same setting, that works, but you do have to get the argument list right. @172 indicates that there are 43 actual arguments in the call (each CHARACTER argument counts as 2).

First, make sure that the procedure COMPR_PT exists and has the same number and data types of arguments as in the call. I suggest you set the project property Fortran > Diagnostics > Check Routine Interfaces to Yes - this will help diagnose mismatch errors. (You probably converted this from a CVF project which would not set that option.)

0 Kudos
muzammil__muhammad
2,576 Views

Good day sir here is my code in intel FORTRAN 77 for finding the roots

but after compiling it I got two errors

1)unresolved externals

2)unresolved external symbol _MAIN_references in function_main

how to resolve these two fatal errors?

 

 

here is my code

!calculating zeros for a function

 

double precision function zeroin(ax,bx,f,tol)

double precision ax,bx,f,tol

double precision a,b,c,d,e,eps,fa,fb,fc,tol1,xm,p,q,r,s

double precision dabs,dsign

c

c compute eps, the relative machine precision

c

eps = 1.0d0

10 eps = eps/2.0d0

tol1 = 1.0d0 + eps

if (tol1 .gt. 1.0d0) go to 10

c

c initialization

c

a = ax

b = bx

fa = f(a)

fb = f(b)

c

c begin step

c

20 c = a

fc = fa

d = b - a

e = d

30 if (dabs(fc) .ge. dabs(fb)) go to 40

a = b

b = c

c = a

fa = fb

fb = fc

fc = fa

c

c convergence test

c

40 tol1 = 2.0d0*eps*dabs(b) + 0.5d0*tol

xm = .5*(c - b)

if (dabs(xm) .le. tol1) go to 90

if (fb .eq. 0.0d0) go to 90

c

c is bisection necessary

c

if (dabs(e) .lt. tol1) go to 70

if (dabs(fa) .le. dabs(fb)) go to 70

c

c is quadratic interpolation possible

c

if (a .ne. c) go to 50

c

c linear interpolation

c

s = fb/fa

p = 2.0d0*xm*s

q = 1.0d0 - s

go to 60

c

c inverse quadratic interpolation

c

50 q = fa/fc

r = fb/fc

s = fb/fa

p = s*(2.0d0*xm*q*(q - r) - (b - a)*(r - 1.0d0))

q = (q - 1.0d0)*(r - 1.0d0)*(s - 1.0d0)

c

c adjust signs

c

60 if (p .gt. 0.0d0) q = -q

p = dabs(p)

c

c is interpolation acceptable

c

if ((2.0d0*p) .ge. (3.0d0*xm*q - dabs(tol1*q))) go to 70

if (p .ge. dabs(0.5d0*e*q)) go to 70

e = d

d = p/q

go to 80

c

c bisection

c

70 d = xm

e = d

c

c complete step

c

80 a = b

fa = fb

if (dabs(d) .gt. tol1) b = b + d

if (dabs(d) .le. tol1) b = b + dsign(tol1, xm)

fb = f(b)

if ((fb*(fc/dabs(fc))) .gt. 0.0d0) go to 20

go to 30

c

c done

c

90 zeroin = b

return

end

 

real function f(x)

f=x*x-4

return

end

0 Kudos
jimdempseyatthecove
Honored Contributor III
2,559 Views

Muhammad,

Try adding the PROGRAM statement as the first line (following comment lines) of your source file.

Also, when posting code use the toolbar </> button.

Jim Dempsey

0 Kudos
muzammil__muhammad
2,510 Views

Thank you for your response Sir, I will do that and problem is solved

0 Kudos
Reply