Our current solution is a mixed C++ Fortran application in Visual Studio 2013, with approximately 40 projects of each.
Although we can build the solution just fine, we are getting about 6000 warnings - a vast majority of which are LNK4006 warnings, where a function is being "duplicated":
warning LNK4006: _XXXXXXXXXXX@8 already defined in project1.lib(module1.obj); second definition ignored project2.lib(module1.obj)
The common thread is that the functions that are being duplicated are defined in Fortran modules - many of which are just interfaces to C++ functions:
MODULE mINTERFACES
USE ISO_C_BINDING
INTERFACE
INTEGER(4) FUNCTION GetLastErrorCode [C, ALIAS: '_GetLastErrorCode'] (index)
USE ISO_C_BINDING
INTEGER(C_SIZE_T), INTENT(IN) :: index
END FUNCTION GetLastErrorCode
END INTERFACE
END
Since these modules are used across many Fortran projects, each project has an independent version of the interface function - hence the duplication.
This all makes perfect sense, but my question is: can I just ignore the warnings (i.e. exclude them in the project configuration)? I can't see any obvious way to restructure our code to remove the warnings, and I was under the impression that putting these interfaces in a module was good practice...