Dupe of http://stackoverflow.com/questions/1077874/linking-errors-from-c-language-in-fortran-lib
Hi,
I have below code in fortran file called server.for
INTEGER iErrPipe !error code for pipe i/o
INTEGER clientIndex !index into client list
CHARACTER*136 Buffer(17) !buffer for pipe i/o
CHARACTER dBuffer(2313) !buffer for pipe i/o
EQUIVALENCE(dBuffer,Buffer)
COMMON/serverstuff/clientIndex,dBuffer
DATA dBuffer(2313)/0/
server.for included in serveral fortran files, the code is compiling successfully but when it comes to linking it is giving below linking errors. this is all happening in Vc 2005.
server_lib.lib(Preparx.obj) : error LNK2005: _SERVERSTUFF already defined in server_lib.lib(Athena7.obj)
2>server_lib.lib(Query.obj) : error LNK2005: _SERVERSTUFF already defined in server_lib.lib(Athena7.obj)
2>server_lib.lib(Utm.obj) : error LNK2005: _SERVERSTUFF already defined in server_lib.lib(Athena7.obj)
2>server_lib.lib(Runvhf.obj) : error LNK2005: _SERVERSTUFF already defined in server_lib.lib(Athena7.obj)
This is all because of "COMMON" decleration from above lines of code is getting called multiple times. but it is compiling successfully with old fortran compiler now i am using fortran 11.0.035 compiler. How can I change the COMMON block code in such a way that i should not get above error??