Hi,
I am porting the application with old fortran compiler and old visual studio(VC5) to new fortran compiler 11 and visual studio 2005. Application contains both 'C' and fortran code. I am compiling the fortran code and creating library called server_lib.lib(library is createing with some warnings) and linking to the 'C' code. while linking application is giving some below linking errors.
2>Linking...
2>server_lib.lib(Preparx.obj) : error LNK2005: _SERVERSTUFF already defined in server_lib.lib(Athena7.obj)
above "serverstuff" is defined in server.for file only and this server.for is included in all above files like Athena7.for,White.fort,Step.for etc.
It sounds as if you did redeclaration by include, like:
File Preparx.for
==========================
INCLUDE "Serverstuff.for"
SUBROUTINE Preparx()
...
END
INCLUDE statement basically works as a copy/paste macro, and in effect you define Subroutine ServerStuff in every of your sources. I don't think that C/Fortran has anything to do with that error.
I don't know how it compiled with another compiler, but that's not the way to do things in Fortran. Actually, that's not how to do things in C either -- C include files should contain just function prototypes, not their bodies.
If my analysis is correct, you should get rid of those INCLUDE lines. Have in mind, though, that I haven't seen your actual code and that I might easily have misdiagnosed the situation.