Error compiling new material - Fortran

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

Post Reply
jmachacek
Posts: 4
Joined: Wed Apr 29, 2015 11:39 pm
Location: Karlsruhe Institut of Technology (KIT)

Error compiling new material - Fortran

Post by jmachacek »

Hi all,

All the materials i use are written in Fortran - therefore i wanted to study the example for adding a new material written in Fortran:
http://opensees.berkeley.edu/WebSVN/lis ... 323c98c91f
(using TortoiseSVN)

I am using VisualStudio 2012 and Visual Fortran Composer XE 2013 to create the elasticPPf.dll
I included all the Fortran-files of the example to the source files of the project.

Unfortunately the .dll can not be built,
the following error messages occure:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Compiling with Intel(R) Visual Fortran Compiler XE 14.0.4.237 [IA-32]...
ifort /nologo /debug:full /Od /I"C:\OpenSees\DEVELOPER\core" /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc110.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /extfor:f /Qvc11 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\\bin" "C:\OpenSees\DEVELOPER\material\fortran\materialTypes.f"
ifort /nologo /debug:full /Od /I"C:\OpenSees\DEVELOPER\core" /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc110.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /extfor:f /Qvc11 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\\bin" "C:\OpenSees\DEVELOPER\material\fortran\materialAPI.f"
ifort /nologo /debug:full /Od /I"C:\OpenSees\DEVELOPER\core" /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc110.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /extfor:f /Qvc11 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\\bin" "C:\OpenSees\DEVELOPER\material\fortran\elasticPPf.f"
Linking...
Link /OUT:"Debug\elasticPPf.dll" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"C:\OpenSees\DEVELOPER\material\fortran\elasticPPf\elasticPPf\Debug\elasticPPf.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\OpenSees\DEVELOPER\material\fortran\elasticPPf\elasticPPf\Debug\elasticPPf.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"C:\OpenSees\DEVELOPER\material\fortran\elasticPPf\elasticPPf\Debug\elasticPPf.lib" /DLL "Debug\materialTypes.obj" "Debug\materialAPI.obj" "Debug\elasticPPf.obj"
Link: executing 'link'
Bibliothek "C:\OpenSees\DEVELOPER\material\fortran\elasticPPf\elasticPPf\Debug\elasticPPf.lib" und Objekt "C:\OpenSees\DEVELOPER\material\fortran\elasticPPf\elasticPPf\Debug\elasticPPf.exp" werden erstellt.
elasticPPf.obj : error LNK2019: unresolved external symbol "_OPS_GETINTINPUT" referenced in function "_ELASTICPPF". (i translated this one)
elasticPPf.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_OPS_GETDOUBLEINPUT" in Funktion "_ELASTICPPF".
elasticPPf.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_OPS_ALLOCATEMATERIAL" in Funktion "_ELASTICPPF".
elasticPPf.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_OPS_ERROR" in Funktion "_LOCALINIT".
Debug\elasticPPf.dll : fatal error LNK1120: 4 nicht aufgelöste Externe

elasticPPf - 5 error(s), 0 warning(s)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Does anyone have an idea how to solve this problem?

Thanks and regards.
jmachacek
Posts: 4
Joined: Wed Apr 29, 2015 11:39 pm
Location: Karlsruhe Institut of Technology (KIT)

Re: Error compiling new material - Fortran

Post by jmachacek »

Maybe it is easier to find the mistake i made if i write down the steps i made:

Mainly i followed the instructions from: https://www.youtube.com/watch?v=BaxFLF6A8Rg

I downloaded and installed TortoiseSVN and downloaded the Developer folder.
To create the .dll i used VisualStudio 2012 and intel visual fortran: New project -> Intel Visual Fortran -> Library -> Dynamic-link Library
I named the file exactly like the materialname.

I loaded all 3 files (materialAPI.f , elasticPPf.f , materialTypes.f) to the source files and tried to build it. The errors are written above.

I was searching for the functions: OPS_GETINTINPUT, OPS_GETDOUBLEINPUT ...

They are also included in the materialAPI file, but there are only the interfaces defined.

Did i miss a step, where i have to load some libraries or add another file?
chbpepsi
Posts: 1
Joined: Sat Jul 27, 2013 12:17 am
Location: Tongji university

Re: Error compiling new material - Fortran

Post by chbpepsi »

Hello, jmachacek
I met the same problem too. Could you tell me how you deal with these problems?
Thanks !
tuanrlc
Posts: 9
Joined: Fri Jul 22, 2016 8:13 pm
Location: Kunsan National University, South Korea

Re: Error compiling new material - Fortran

Post by tuanrlc »

Hi guys,
I am facing the same problem.
Can you give me some detail instructions.
Thanks!
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: Error compiling new material - Fortran

Post by fmk »

probably a c++ fortran thing on the calling of C functions .. the fotran compiler is expecting all capitals in function name, the C++ compiler can generate all lowercase, keep as is, add crap to end .. you might want to search the obj file for the win32Functions.cpp file to see just exactly what name the functions have .. and look at the c++ or fortran compiler options to see how to change it to get function call you want.
tuanrlc
Posts: 9
Joined: Fri Jul 22, 2016 8:13 pm
Location: Kunsan National University, South Korea

Re: Error compiling new material - Fortran

Post by tuanrlc »

Dear fmk,
Thanks for your response!
mpoliotti
Posts: 5
Joined: Thu Jul 13, 2017 6:11 am
Location: Universidad Politecnica de Catalunya

Re: Error compiling new material - Fortran

Post by mpoliotti »

tuanrlc im having the same problem.
Can you post some details of how you solved it?
Thanks
mpoliotti
Posts: 5
Joined: Thu Jul 13, 2017 6:11 am
Location: Universidad Politecnica de Catalunya

Re: Error compiling new material - Fortran

Post by mpoliotti »

Hi everyone, im still struggling with the example compilation. Im using VS2017, i defined a new fortran project of an empty dll and i included the 3 files elasticPPf, materialAPI, and material Types. After solving some issues with upper and lower cases of variables, i tried to compile the solution and i get :

Gravedad Código Descripción Proyecto Archivo Línea Estado suprimido
Error error LNK2019: símbolo externo _OPS_Error sin resolver al que se hace referencia en la función _LOCALINIT elasticPPf.obj
Error error LNK2019: símbolo externo _OPS_GetIntInput sin resolver al que se hace referencia en la función _ELASTICPPF elasticPPf.obj
Error error LNK2019: símbolo externo _OPS_GetDoubleInput sin resolver al que se hace referencia en la función _ELASTICPPF elasticPPf.obj
Error error LNK2019: símbolo externo _OPS_AllocateMaterial sin resolver al que se hace referencia en la función _ELASTICPPF elasticPPf.obj

In the compilation properties I tried different options, on the External Procedures window I tried to change the Name Case Interpretation to every posible option (Upper Case, Lower Case, As-is) but none of them worked.
Any ideas on whats going on??' Is there any path that I have to define??

Thanks
Post Reply