[omniORB] Static-linking in Visual C++

Sven Eklund sek@leissner.se
Sun, 17 May 1998 23:59:15 +0200


Hello!

I have a static-built application I want to use with omniORB. I can get
it compile correctly with omniORB in DLL-version, but if I change to
compile with omniORB2.lib and omnithread.lib (static versions) and set
_WINSTATIC-macro I get the following link-errors:

Linking...
msvcirt.lib(MSVCIRT.dll) : error LNK2005: "public: class ostream &
__thiscall ostream::operator<<(char const *)"
(??6ostream@@QAEAAV0@PBD@Z) already defined in libcimt.lib(ostream.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _sscanf already defined in
libcmt.lib(sscanf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strncmp already defined in
libcmt.lib(strncmp.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _getenv already defined in
libcmt.lib(getenv.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in
libcmt.lib(fclose.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strncpy already defined in
libcmt.lib(strncpy.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _isspace already defined in
libcmt.lib(_ctype.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _sprintf already defined in
libcmt.lib(sprintf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: __errno already defined in
libcmt.lib(dosmap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _atoi already defined in
libcmt.lib(atox.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _strchr already defined in
libcmt.lib(strchr.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _memmove already defined in
libcmt.lib(memmove.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other
libs; use /NODEFAULTLIB:library
Release/DistRapport.exe : fatal error LNK1169: one or more multiply
defined symbols found
Error executing link.exe.

I have tested to use "/NODEFAULTLIB:xxx", adding libcmt and so on, but
I'm always get a couple of similiar errors.

It looks like the omniorb-libs need msvcrt/msvcirt which, if I have
understood things right, not should be used if you want a static-linked
program.

Have anyone else succedded to compile a static-linked omniORB enabled
MFC Windows-application in VC++ 5.0? 

Any ideas what I can do, except to use dll-versions of omniORB-libs?

I will also say that I'm very impressed of omniORB. It seems to have
very good performance and seems also stable. I'm using omniORB with Win
95/NT, Solaris 2.6 (Intel) and AIX 4.1 (AIX just tested, with good
result).

Regards,

Sven Eklund
Leissner Data AB
SWEDEN
E-Mail sek@Leissner.se