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
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.
笔者的问题并不是因为以上,文件和函数明明都在问什么无法链接呢。
测试后发现是添加的cpp文件无法编译导致,测试方法就是Ctrl+F7,编译该文件,发现没反应,就需要将源文件移除,重新添加即可