Hello, I am attempting to make use of a number of fortran functions and subroutines in a C++ project by using a generated .lib file. When compiling my C++ project, I get a linker error:
error LNK2019: unresolved external symbol _Leakage_SPH referenced in function
The function is called with Leakage_SPH (note no underscore), so I think this is the root of my problem. When I check the fortran code for this subroutine, I see:
Subroutine Leakage_SPH(Nu0,FracLkgTot,tlkg,NHoles, + ObjDat, holeAreas, holeHeights) !DEC$ATTRIBUTES DLLEXPORT, C :: Leakage_SPH !DEC$ATTRIBUTES ALIAS : '_Leakage_SPH' :: Leakage_SPH !DEC$ATTRIBUTES REFERENCE :: FracLkgTot
This appears to give an alias of _Leakage_SPH so that the definition can be found. But something isn't working. The code compiles in fortran and the library is generated and placed in the correct spot. One thing I noticed is this remark that I get when compiling the fortran code:
remark #5082: Directive ignored - Syntax error, found ':' when expecting one of: , <END-OF-STATEMENT> ;
This appears to be pointing to my ALIAS line. Can anyone see what error I've made? Apologies if I've messed up any formatting; this is my first time posting on this forum (and indeed, my first time working with fortran at all as I usually work in C++). Thanks.