Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

Debug Error

msaadatpour
Beginner
710 Views
Dear Admin


I am going to compile a program codeing of software. All the files are in the subroutine and/or function format. I've written a main program to eliminate the linking error as "error LNK2019: unresolved external symbol _MAIN__ referenced in function _main". The initiatesoftware run commands are included in the function entiteled CE_QUAL_W2 as below


INTEGER(4) FUNCTION CE_QUAL_W2 (DLG)

! CVF specific code

USE DFLOGM; USE MSCLIB; USE DFWIN, RENAMED => DLT;

!DEC$ATTRIBUTES STDCALL :: ce_qual_w2

!DEC$ATTRIBUTES REFERENCE :: Dlg

USE IFPORT ! to get current working directory

USE MAIN

USE GLOBAL; USE NAMESC; USE GEOMC; USE LOGICC; USE PREC; USE SURFHE; USE KINETIC; USE SHADEC; USE EDDY

USE STRUCTURES; USE TRANS; USE TVDC; USE SELWC; USE GDAYC; USE SCREENC; USE TDGAS; USE RSTART

use macrophytec; use porosityc; use zooplanktonc !v3.5

include "omp_lib.h" ! OPENMP directive to adjust the # of processors

EXTERNAL RESTART_OUTPUT

TYPE (DIALOG) :: DLG

INTEGER :: RESULT

.
.
.
END FUNCTION CE_QUAL_W2

I've added the main program as below


program waterqualities

USE DFLOGM; USE MSCLIB; USE DFWIN

USE IFPORT ! to get current working directory

USE MAIN

USE GLOBAL; USE NAMESC; USE GEOMC; USE LOGICC; USE PREC; USE SURFHE; USE KINETIC; USE SHADEC; USE EDDY

TYPE (DIALOG) :: DDLG

RunsRes=CE_QUAL_W2 (DDLG)

end program waterqualities


I have the error message as "error LNK2019: unresolved external symbol _CE_QUAL_W2 referenced in function _MAIN__". Would you please help me. I've attached the files.


Bests
M. Saadatpour


0 Kudos
2 Replies
anthonyrichards
New Contributor III
710 Views
Add an Interface block for your function to your main program that calls it (or put it in a module and then USE the module in your main program and anywhere else that you reference the function).

INTERFACE
INTEGER(4) FUNCTION CE_QUAL_W2 (DLG)
USE DFLOGM
TYPE (DIALOG) :: DLG
END FUNCTION
END INTERFACE

so that the compiler knows what to look for.
Ensure that your function definition code is included in your project.
0 Kudos
msaadatpour
Beginner
710 Views
Thanks alot.

Regards
0 Kudos
Reply