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

linking problem

kskr
Beginner
555 Views
I am trying to link some object files to create a executable file. The source code contains only fortran. the source files were compiled without any problem. But i am not able to link them as i am getting this error.

libifcoremt.lib(libifcoremain.obj) : error LNK2019: unresolved external symbol _
MAIN__ referenced in function _main
test.exe : fatal error LNK1120: 1 unresolved externals

any help would be very much appreciated
--kskr
0 Kudos
3 Replies
Steven_L_Intel1
Employee
555 Views
This means that you do not have a main program, just subroutines. You will need a main program (starts with either a PROGRAM statement or something other than SUBROUTINE, FUNCTION, MODULE or BLOCK DATA.)

Most likely you need to create a main program that calls a subroutine.
0 Kudos
kskr
Beginner
555 Views
Thanks for replying to my message.
I have a main program that calls the subroutines. i am still getting the same error. i am attaching my main program that calls the subroutines. please let me if any thing more is to be added.

--kskr


0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
555 Views

Steve is on vacation, so let me answer.

Your .f file looks fine. Are you linking on the command line? If so you should try linking with ifort (it will call the Microsoft linker). If you are linking from inside Microsoft Visual Studio, make sure your project includes and builds all the files. For some custom advice you can file an issue at premier.intel.com with a complete test case (inluding build instructions or a complete project.

Wendy D.

Intel Developer Support

0 Kudos
Reply