Link to home
Start Free TrialLog in
Avatar of aditya_mehta
aditya_mehta

asked on

Linking issues in MSVC program using IONA's Orbacus 4.1.1

Hi,

I have the source code of IONA's Orbacus 4.1.1 product and a makefile for MSVC supplied by IONA to compile the product. In the instructions it is mentioned that I have to compile any program which uses Orbacus 4.1.1 using the same compiler options which I used to compile the Orbacus 4.1.1 source code. I compiled Orbacus 4.1.1 using the default options which were there in the makefile for MSVC supplied by IONA. Then I studied the makefile and used the same compiler /linker switches to compile my program (a simple hello world application). The are no errors in compiling but errors in linking which are detailed below:

Linking...
msvcirtd.lib(MSVCIRTD.dll) : error LNK2005: "public: class ostream & __thiscall ostream::operator<<(class ostream & (__cdecl*)(class ostream &))" (??6ostream@@QAEAAV0@P6AAAV0@AAV0@@Z@Z) already defined in Server.obj
msvcirtd.lib(MSVCIRTD.dll) : error LNK2005: "class ostream & __cdecl endl(class ostream &)" (?endl@@YAAAVostream@@AAV1@@Z) already defined in Server.obj
LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRT.lib(MSVCRT.dll)
LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRT.lib(crtexe.obj)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCRT.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRT.lib(MSVCRT.dll)
LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCRT.dll)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
libcimtd.lib(streamb.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z)
Debug/CS.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

CS.exe - 13 error(s), 2 warning(s)

If I exclude the libraries MSVCRT and LIBCMT using /NODEFAULTLIB option of MSVC 6.0 then I get lot more errors because of other symbols which are required from these two libraries.

I will tell you what compiler options I am using for compiling both Orbacus 4.1.1 and my program.

Orbacus is compiled using:

1. Default options in the makefile for MSVC where /MD flag is default, ie. compile as multithreaded dll with no debug options.
2. OLD_IOSTREAM is not defined at all.
3. DEBUG is not defined at all.

A typical command line for compiling Orbacus 4.1.1 is:
cl.exe /c /I. /I ..\include /DWIN32 /nologo /MD /W3 /Gx /Gy /GR /Fd ..\lib\jtc.pdb

A new MSVC project is chosen as:

1. 'Win32 Console Application', 'Empty Project'.
2. 'Multithreaded DLL' from 'use run-time library:' option, ie. /MD flag is set.
3. 'Enable Exception Handling' and 'Enable Run-Time Type Information (RTTI' from 'Project Settings -> C/C++ -> C++ Language' option.
4. Libraries wsock32.lib, advapi.lib, ob.lib, jtc.lib added to 'Project Settings -> Link -> Input -> Object/library modules' option.
5. In cpp files I/O library file included is 'iostream.h'.

I want to know if I need to change some compiler / linker options in the makefile to compile Orbacus 4.1.1 or I need to change some compiler / linker options of MSVC for the program which uses Orbacus 4.1.1.

Best regards,
Aditya
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dear aditya_mehta

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "nietod"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Avatar of Mindphaser
Mindphaser

Force accepted

** Mindphaser - Community Support Moderator **