?
Solved

linker error ".... already defined in xxxx"

Posted on 2010-09-22
7
Medium Priority
?
577 Views
Last Modified: 2012-05-10

Hello,

I'm trying to compile a program but it gives an error like below:

Executing: ""C:\Rhapsody752\Share"\etc\msvc9make.bat deneme.mak build "
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
The filename, directory name, or volume label syntax is incorrect.
Building library deneme.dll msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in OpcServer.obj

I added OpcServer.obj from another project. What's the problem here?
Could you help me please?
0
Comment
Question by:vileda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 40

Accepted Solution

by:
evilrix earned 1000 total points
ID: 33734286
My first thought would be that you are trying to link to an object file that was build using a different version of the C Runtime.
http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx

You need to ensure all objects are build using the same runtime.
0
 
LVL 32

Assisted Solution

by:phoffric
phoffric earned 1000 total points
ID: 33734358
The error is a multiply defined symbol located in OpcServer.obj.
Here are some suggestions on resolving this error:
     http://msdn.microsoft.com/en-us/library/72zdcz6f%28VS.80%29.aspx
0
 
LVL 32

Expert Comment

by:phoffric
ID: 33734383
Do you have the source code so that you can compile it along with the rest of your project?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 40

Expert Comment

by:evilrix
ID: 33734745
>> The error is a multiply defined symbol located in OpcServer.obj.

Note that the symbol is ~basic_string, suggesting mixed CRT
0
 

Author Comment

by:vileda
ID: 33741439
I compiled my main program with /MT option and my libray OPCServer.obj with /MD option.  I don't have any idea about how it worked but It worked.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 33741893
>> I don't have any idea about how it worked but It worked.

are you saying that resolve it? I suspect that it's not really since you are still using two different C runtimes.

MT: Multithreaded, static link
MD: Multithreaded, dynamic link (import library for MSVCR80.DLL). Be aware that if you use the Standard C++ Library, your program will need MSVCP80.DLL to run.

You should should the same C runtime otherwise you will (potentially) get undefined behaviour.
0
 

Author Closing Comment

by:vileda
ID: 33768648
closed
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

800 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