Solved

Linking issues in MSVC program using IONA's Orbacus 4.1.1

Posted on 2002-06-11
3
1,020 Views
Last Modified: 2008-03-17
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
0
Comment
Question by:aditya_mehta
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 25 total points
ID: 7072471
It sounds like you are liking to both the DLL and staticly linked run time libraries (RTL).    Vc has two versions of the RTL, one is a DLL, which must be pressent when the program is run and the other is the static version that gets placed right into your program.   It sounds like your are using both.

I think that linking to MSVCRT.LIB is the problem.  Can you remove the option to link to it?
0
 
LVL 11

Expert Comment

by:griessh
ID: 7262266
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
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7332931
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error C2678: binary '!=': no operator found... 4 58
gdb doesn't stop on breakpoint 2 95
Outlook 13 41
Need some help with mailto 16 20
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question