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

libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol

Brian_A_
Novice
2,228 Views

I am compiling using

Windows 10 - IFC Version 15.0.1.148 Build 20141023

I am getting error creating my DLL.  I can create a EXE just fine.

Makerfile

FL = -auto -Qansi_alias- -pad_source -traceback \
-fltconsistency -fpconstant -nogen-interfaces

$(r)5.dll : lib\$(e)$(NM).lib lib\graphics.lib \
	              lib\$(m)$(NM).lib lib\$(r)$(NM).lib \
                  $(r)\$(r)5.$O lib\$(s)$(NM).lib \
                  tpfh2o$(NM) tpfd2o$(NM)
	$(f90) -nologo $(FFLAGS) $(FPSTOP) $(FL) -threads -dll \
	$(r)\$(r)5.$O lib\$(r)$(NM).lib lib\$(s)$(NM).lib \
	lib\$(m)$(NM).lib lib\$(e)$(NM).lib \
	lib\graphics.lib libmmt.lib kernel32.lib ifqwin.lib gdi32.lib \
	libifcoremt.lib libifport.lib \
	user32.lib libirc.lib comdlg32.lib ifqw_mdi.lib libcmt.lib \
	imagehlp.lib opengl32.lib glu32.lib lib\f90gl.lib lib\f90glu.lib \
	lib\f90glut.lib lib\glut32.lib -link -out:$(r)5.dll -nodefaultlib

 

The error that I am getting is:

libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ referenced in function _main
relap5.dll : fatal error LNK1120: 1 unresolved externals

0 Kudos
4 Replies
Kevin_D_Intel
Employee
2,228 Views

Try placing the -dll option after -link to ensure it is passed to the link phase. It seems like the error indicates the link wants to create an .exe instead of a DLL.

0 Kudos
Brian_A_
Novice
2,228 Views

I moved -dll to be after -link and that made no difference.

 

$(r)5.dll : lib\$(e)$(NM).lib lib\graphics.lib \
	              lib\$(m)$(NM).lib lib\$(r)$(NM).lib \
                  $(r)\$(r)5.$O lib\$(s)$(NM).lib \
                  tpfh2o$(NM) tpfd2o$(NM)
	$(f90) -nologo $(FFLAGS) $(FPSTOP) $(FL) -threads \
	$(r)\$(r)5.$O lib\$(r)$(NM).lib lib\$(s)$(NM).lib \
	lib\$(m)$(NM).lib lib\$(e)$(NM).lib lib\graphics.lib \
	libmmt.lib kernel32.lib ifqwin.lib gdi32.lib libifcoremt.lib \
	libifport.lib user32.lib libirc.lib comdlg32.lib ifqw_mdi.lib \
	libcmt.lib imagehlp.lib opengl32.lib glu32.lib lib\f90gl.lib \
	lib\f90glu.lib lib\f90glut.lib lib\glut32.lib \
	-link -dll -out:$(r)5.dll -nodefaultlib

 

0 Kudos
Kevin_D_Intel
Employee
2,228 Views

Ok. I don't have anything readily available to try this myself at the moment. Are you just using a makefile under something like Cygwin? 

0 Kudos
Lorri_M_Intel
Employee
2,228 Views

If I may suggest ...

Please put /dll back before the /link.

And, before the "-nologo" please add "-Bd".   This will show the driver-tool commands, and should help us understand why "/dll" isn't being honored.

Redirect the output to a file, and attach it to a reply, please.   If there are sensitive filenames, etc. in the output, feel free to scramble them, but please leave the actual "link" or "ifort" commands as is.

                        Thanks -

                                            --Lorri

 

0 Kudos
Reply