error LNK1120 and LNK2001 while building

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

Moderators: silvia, selimgunay, Moderators

Post Reply
TOKYOTech
Posts: 22
Joined: Tue Feb 23, 2016 9:51 pm
Location: Tokyo Institute of Technology

error LNK1120 and LNK2001 while building

Post by TOKYOTech »

Dear FMK,

I downlode the latest source code on svn last week and try to build the OpenSees.exe on my x64 win10. I open the ../win64/OpenSees.sln with VS2015. The OpenSees project is set as the StartUp project. The tcl/include and tcl/lib is added to the VC++ Directories. The following error occurred while building OpenSees project.

25> Generating Code...
25>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/FORCE' specification
25> umfpackC.lib(SuiteSparse_config.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
25>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
25> Creating library .\..\..\bin\OpenSees.lib and object .\..\..\bin\OpenSees.exp
25>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
25>LIBCMTD.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
25>actor.lib(FEM_ObjectBrokerAllClasses.obj) : error LNK2001: unresolved external symbol "public: __cdecl DataFileStreamAdd::DataFileStreamAdd(int)" (??0DataFileStreamAdd@@QEAA@H@Z)
25>recorder.lib(TclRecorderCommands.obj) : error LNK2001: unresolved external symbol "public: __cdecl DataFileStreamAdd::DataFileStreamAdd(char const *,enum openMode,int,int,bool,int,bool)" (??0DataFileStreamAdd@@QEAA@PEBDW4openMode@@HH_NH2@Z)
25>libifcoremt.lib(for_diags_intel.obj) : error LNK2001: unresolved external symbol vsprintf
25>libirc.lib(irc_msg_support.obj) : error LNK2001: unresolved external symbol vsprintf
25>libifcoremt.lib(for_diags_intel.obj) : error LNK2001: unresolved external symbol __iob_func
25>libifcoremt.lib(for_nt_open_proc.obj) : error LNK2001: unresolved external symbol __iob_func
25>libm.lib(libm_error.obj) : error LNK2001: unresolved external symbol __iob_func
25>libm.lib(libm_error.obj) : error LNK2001: unresolved external symbol _snprintf
25>libirc.lib(tbk_display.obj) : error LNK2001: unresolved external symbol _snprintf
25>material.lib(TclModelBuilderNDMaterialCommand.obj) : error LNK2001: unresolved external symbol "public: __cdecl CapPlasticity::CapPlasticity(int,double,double,double,double,double,double,double,double,double,double,double,double,int,double)" (??0CapPlasticity@@QEAA@HNNNNNNNNNNNNHN@Z)
25>.\..\..\bin\OpenSees.exe : fatal error LNK1120: 6 unresolved externals

Could you help me with that? Thank you very much!
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: error LNK1120 and LNK2001 while building

Post by fmk »

the missing DataFileStreamAdd and CapPlasticity you need to add the .cpp files to the projects or co a version that corresponds to last release

the others i am not sure about/
TOKYOTech
Posts: 22
Joined: Tue Feb 23, 2016 9:51 pm
Location: Tokyo Institute of Technology

Re: error LNK1120 and LNK2001 while building

Post by TOKYOTech »

@fmk Thank you very much for your reply. If I want to modify some of the existing material in OpenSees to make it a useable .dll file , which parts of the .cpp and .h file should I modify. For now I change the name of the material and some mat_tag define, but it doesn't work even for some simple material. I wonder if I am doing it wrong. Since the build didn't work well, I hope I could use the .dll method instead. Thank you for your time.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: error LNK1120 and LNK2001 while building

Post by fmk »

i have not tried the dll approach with VS2015 so I don't know .. do the basic examples provided in the DEVELOPER directory work.
TOKYOTech
Posts: 22
Joined: Tue Feb 23, 2016 9:51 pm
Location: Tokyo Institute of Technology

Re: error LNK1120 and LNK2001 while building

Post by TOKYOTech »

@fmk, thank you for your reply.The example in the DEVELOPER directory works well. So I think VS2015 may be the same as VS2010. The ElasticPPcpp.dll was created and could be used by OpenSees. As for a test, follow the same procedures I changed the Concrete02.cpp .h to Concrete22.cpp .h(just change the name and related MAT_TAG). The Concrete22.dll is created, but the OpensSees could not use it with a warning " Could not creat uniaxialMaterial Concrete22" . So I think maybe the change of just name and MAT_TAG is not enough. What's more should I do to modify the existing material .cpp and .h if I want to make it a dll approach. Thank you very much for your time!
idealzeng
Posts: 3
Joined: Sun May 21, 2017 4:42 am
Location: shenzhen,china
Contact:

Re: error LNK1120 and LNK2001 while building

Post by idealzeng »

do you complie successfully in vs2015?
in vs2017, the same error come out as yours.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: error LNK1120 and LNK2001 while building

Post by fmk »

did you change the OPS_ procedure name and the name of the XXX.dll .. it looks for a dll of a specific name (the ele command) and an OPS_XXX procedure withinn that .dll .. if either is not found, or the dll was compiled with DEVELOPER code that is different from th .exe_ that is when you get the error.
idealzeng
Posts: 3
Joined: Sun May 21, 2017 4:42 am
Location: shenzhen,china
Contact:

Re: error LNK1120 and LNK2001 while building

Post by idealzeng »

I have complie successfully in vs2017,when i setup intel fortran 2018, and the errors didn't come out.
Post Reply