GiDpost linking error

Moderator: GiD Team

Post Reply
j.m.
Posts: 3
Joined: Fri Feb 16, 2018 11:07 am

GiDpost linking error

Post by j.m. »

Dear GiD-community,

i wrote an inhouse finite element code in Fortran 2003.
Searching for a post-processor i came across GiD and was instantly confinced
after i found out, that a fortran interface to GiDpost is provided as well.

Unfortunately i was stopped by some linking errors and was not able to solve them.
So i am hoping, one of you can help me...

I am using Visual Studio 2012 and the Intel(R) Visual Fortran Compiler 17.0.4.210
To link GiDpost to the code i folloewd these steps:

1) Add the gidpost.f90 file to the source files of the program
2.1) Link the library path: Linker -> General -> Additional Library Dependencies -> path_to_libraries
2.2) Link the library files: Linker -> Input -> Additional Dependencies -> gidpost.lib zlib.lib hdf5.lib
3) Create a module output containing the subroutine write_output_file that loads the gidpost module: use gidpost
4) Compile (Debug mode)

The errors can be seen in this here:
error_gid_1.png
error_gid_1.png (40.17 KiB) Viewed 3350 times

I also tried to compile and run the provided example testpost_fd.f90, but the results are similar:
problem_gid_2.png
problem_gid_2.png (14.01 KiB) Viewed 3350 times


i actually tried also to just dump the *.lib files in the source files directory. The roors were the same.


the fortran module can be found here:
Intel.Fortran.IFLangService.IVFViewPaginator_Seite_1.jpg
Intel.Fortran.IFLangService.IVFViewPaginator_Seite_1.jpg (614.67 KiB) Viewed 3350 times
Intel.Fortran.IFLangService.IVFViewPaginator_Seite_2.jpg
Intel.Fortran.IFLangService.IVFViewPaginator_Seite_2.jpg (530.3 KiB) Viewed 3350 times
Thank you!

Edit: Sorry, somehow the attachments were arranged wrong.
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: GiDpost linking error

Post by escolano »

Try doing what the compiler has suggested:
specify to the linker to ignore one of the repeated definitions
/NODEFAULTLIB: library
to do it in Visual Studio go to the 'project properties' window

Linker->Input:
Ignore Specific default Libraries
LIBCMT.lib
and/or
LIBCMTD.lib

(I think that the version with D is because you are compiling a debug version)
try some combinations of libraries to be ignored, depending on the messages of your compiler

You can also compile the gidpost.lib library, the source code is provide (a C/C++ compiler is required off course)
and the zlib source code could be downloaded from Internet (it is open source) and recompiled also if necessary.
about hdf5.lib is also open source and can be downloaded and compiled, but its use is not strictly necessary (if you don't want use this format), and is possible no to use it (commenting the #define HDF5 in gidpost_config.h)
j.m.
Posts: 3
Joined: Fri Feb 16, 2018 11:07 am

Re: GiDpost linking error

Post by j.m. »

Thank you for your suggestion and please excuse the late reply,
unfortunately I had no time to work on this project last week.

You were right, the problems result from using a release version of the libraries in debug mode.

Excluding internal libraries did not work (the consequence was just a ton of new errors)

This did the job:
  • Recompile zlib.lib (and create a debug-version!)
    • Important: change the /MD flags to /MT (and /MDd to /MTd) to remove the overlap with internal dependencies
  • Recompile gidpost.lib (and create a debug version)
Post Reply