linking g95-built library from VC++
- From: "Matthew Halfant" <halfant@xxxxxxx>
- Date: Fri, 30 Jun 2006 02:39:42 GMT
I've built a library of Fortran 95 functions using g95 on Win2k, and
my colleagues at work need to statically link to it from Microsoft
VC++. I seem to be making progress, but don't really know what I'm
doing, and am hoping that someone has worked through these issues and
can advise.
I'm building the library with
g95 -O3 -c foo_1.f90
g95 -O3 -c foo_2.f90
...
ren *.o *.obj
lib /out:fortlib.lib *.obj
The C interface is caller.c and I'm trying to use cl (VC++ C Compiler)
to build the final executable. Toward that end I copy libf95.a and
libgcc.a as .lib files:
copy libf95.a f95.lib
copy libgcc.a gcc.lib
cl caller.c fortlib.lib f95.lib gcc.lib
The link stage reports the following error:
f95.lib(environ.o) : error LNK2001: unresolved external symbol
___p__environ
I tried to remedy this by including also the GNU library libmsvcrt.a,
copied to the name msvcrt.lib:
cl caller.c fortlib.lib f95.lib gcc.lib msvcrt.lib
This now produces the complaint:
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in
msvcrt.lib(dkxs00554.o)
LIBC.lib(strchr.obj) : error LNK2005: _strchr already defined in
msvcrt.lib(dkxs00664.o)
caller.exe : fatal error LNK1169: one or more multiply defined symbols
found
Any suggestions?
Thanks,
Matthew
.
- Follow-Ups:
- Re: linking g95-built library from VC++
- From: Matthew Halfant
- Re: linking g95-built library from VC++
- Prev by Date: Re: removing blanks from a file
- Next by Date: Re: removing blanks from a file
- Previous by thread: removing blanks from a file
- Next by thread: Re: linking g95-built library from VC++
- Index(es):