[Paraview-developers] Linker error building Fortran90FullExample
thomasblome at startmail.com
thomasblome at startmail.com
Thu Nov 10 13:10:25 EST 2016
Hi Andy,
The linker error concerning the missing main method was due to a wrong
solution setup of the Fortran90FullExample in VS.
The CMakeLists file provided generates only one single (C++) project in
VS, which means all .f90 files will be ignored by the compiler (it's
impossible to have a single Fortran/C++ mixed language project in VS).
To solve this I had to configure the CMakeLists file to create a
library from FECxxAdaptor.cxx and link it with the
Fortran90FullExample.
Other linker & compiler errors occurred with regards to mpi:
1) the target_link_libraries command in the CMakeLists file links
${MPI_Fortran_LIBRARIES} to the fortran project,
but it forgets to link with msmpifec.lib (see also:
http://public.kitware.com/pipermail/cmake/2016-February/062861.html).
2) The specification of an include directory (containing header
mpifptr.h) was missing.
Another problem arose when it comes to the the by hand name mangling
for fortran in FECxxAdaptor.cxx.
To get rid of that I introduced function interfaces in the
FEFortranAdaptor.f90 file and now it works independently of the Fortran
compiler used.
Now, there are only five remaining linker errors as shown below:
LNK2019: unresolved external symbol COPROCESS referenced in function
TCP_mp_TESTCOPROCESSOR FEFortranAdaptor.obj
LNK2019: unresolved external symbol COPROCESSORINITIALIZEWITHPYTHON
referenced in function MAIN__ FEDriver.obj
LNK2019: unresolved external symbol COPROCESSORFINALIZE referenced in
function MAIN__ FEDriver.obj
LNK2019: unresolved external symbol NEEDTOCREATEGRID referenced in
function TCP_mp_TESTCOPROCESSOR FEFortranAdaptor.obj
LNK2019: unresolved external symbol REQUESTDATADESCRIPTION referenced
in function TCP_mp_TESTCOPROCESSOR FEFortranAdaptor.obj
In the ParaViewCatalystUsersGuide_v2 the missing symbols appear to be
declared in CAdaptorAPI.h and CPythonAdaptorAPI.h (but
NEEDTOCREATEGRID),
but I can't just include them in the Fortran code.
Can you tell me how to resolve those missing references?
Best,
Thomas
Am Mittwoch, 26. Oktober 2016 18:47 schrieb Andy Bauer
<andy.bauer at kitware.com>:
> Hi Thomas,
>
> I really don't know about this. Do you get the same behavior if you
> don't link with Catalyst? Can you create a simple helloworld.f90
> example that works?
>
> Best,
> Andy
>
> On Wed, Oct 26, 2016 at 3:39 AM, <thomasblome at startmail.com> wrote:
>> Hi Andy,
>>
>> I have changed both lines from coproc to main, but the error message
>> remains the same.
>>
>> Best,
>> Thomas
>>
>> Am Montag, 24. Oktober 2016 22:00 schrieb Andy Bauer <andy.bauer at kitware.com>:
>>
>>> Hi Thomas,
>>>
>>> If you change from coproc to main in the "program" and "end
>>> program" lines in FEDriver.f90 does that fix the problem?
>>>
>>> I'm working on a fix for this but don't have access to any MSVS
>>> compilers.
>>>
>>> Thanks,
>>> Andy
>>>
>>> On Sat, Oct 22, 2016 at 1:46 PM, <thomasblome at startmail.com> wrote:
>>>> Hello,
>>>>
>>>> I'm trying to compile the Fortran90FullExample using MSVS (Intel
>>>> Fortran Compiler 2017 and Visual C++ 2015 compiler).
>>>> Doing so I'm getting following linker error:
>>>>
>>>> Error LNK2019 unresolved external symbol main referenced in
>>>> function "int __cdecl __scrt_common_main_seh(void)"
>>>> (?__scrt_common_main_seh@@YAHXZ) Fortran90FullExample.
>>>>
>>>> Obviously, the source code doesn't contain a main method at all,
>>>> since the entry point is given by the fortran program in file
>>>> 'FEDriver.f90'.
>>>> Nevertheless, I guess the compiler internally creates a main
>>>> method, and the linker cannot resolve the reference due to a name
>>>> mangling problem, as there are different compilers involved. But
>>>> I'm not quite sure about that, nor how to solve it, at that
>>>> matter.
>>>>
>>>> Can you give me a hint how to solve that problem?
>>>>
>>>> Kind regards,
>>>> Thomas
>>>> _______________________________________________
>>>> Powered by www.kitware.com <http://www.kitware.com>
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Search the list archives at:
>>>> http://markmail.org/search/?q=Paraview-developers
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/paraview-developers
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20161110/5efcbebc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 7F53DEC77F67D0E0.asc
Type: application/pgp-keys
Size: 3082 bytes
Desc: OpenPGP public keys
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20161110/5efcbebc/attachment.key>
More information about the Paraview-developers
mailing list