473,468 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

error LNK2005: "class std::basic_istream

Hi,

I have a C++ application that calls a function in another static library
which accepts a std::string parameter. However, my VS 2005 compiler shows
the following error:

msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "class
std::basic_istream<char,struct std::char_traits<char & __cdecl
std::getline<char,struct std::char_traits<char>,class std::allocator<char>
>(class std::basic_istream<char,struct std::char_traits<char &,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char &)"
(??$getline@DU?$char_traits@D@std@@V?$allocator@D@ 2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std @@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std @@V?$allocator@D@2@@0@@Z) already defined in log4cppLIB.lib(Category.obj)

Any idea how I can resolve this problem?
Regards

cleohm

Feb 1 '07 #1
4 4125
>I have a C++ application that calls a function in another static library
>which accepts a std::string parameter. However, my VS 2005 compiler shows
the following error:
...
Ensure that both your application and the static library are build
with the same run-time library options. Since your EXE is trying to
use the DLL run-time, your static library should do exactly the same.
Also, ensure that a debug build of one uses the debug build of the
other, and vice-versa for the release build. Needless to say, all
should be built with the same version of the compiler/linker.

Dave
Feb 1 '07 #2
Thanks for your reply. In fact I have recompiled my library in vs 2005 which
was previously in vs2003, and it works. However, something I am rather
curious about is that most open source libraries do not support vs2005
however, some of them recommend the use of a 2003 library and it works fine
in my vs2005. Is that a particular reason why?

"David Lowndes" wrote:
I have a C++ application that calls a function in another static library
which accepts a std::string parameter. However, my VS 2005 compiler shows
the following error:
...

Ensure that both your application and the static library are build
with the same run-time library options. Since your EXE is trying to
use the DLL run-time, your static library should do exactly the same.
Also, ensure that a debug build of one uses the debug build of the
other, and vice-versa for the release build. Needless to say, all
should be built with the same version of the compiler/linker.

Dave
Feb 1 '07 #3
>Thanks for your reply. In fact I have recompiled my library in vs 2005 which
>was previously in vs2003, and it works.
Great.
However, something I am rather
curious about is that most open source libraries do not support vs2005
however, some of them recommend the use of a 2003 library and it works fine
in my vs2005. Is that a particular reason why?
It's hard to say without a specific (concise) example. Generally
you're asking for problems if you try to use static libraries from
different versions of the compiler. If the library is for a DLL, then
providing the DLL interface does not involve types allocated from the
run-time (i.e. it uses POD types only, or ones from a common memory
manager), then it would be OK.

Dave
Feb 1 '07 #4
Thanks!

"David Lowndes" wrote:
Thanks for your reply. In fact I have recompiled my library in vs 2005 which
was previously in vs2003, and it works.

Great.
However, something I am rather
curious about is that most open source libraries do not support vs2005
however, some of them recommend the use of a 2003 library and it works fine
in my vs2005. Is that a particular reason why?

It's hard to say without a specific (concise) example. Generally
you're asking for problems if you try to use static libraries from
different versions of the compiler. If the library is for a DLL, then
providing the DLL interface does not involve types allocated from the
run-time (i.e. it uses POD types only, or ones from a common memory
manager), then it would be OK.

Dave
Feb 2 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: marwie | last post by:
Hi, I'm trying to derive my own stream class from std::basic_istream and I'm having problems getting operator>> to work. Consider the following little program: #include <iostream> #include...
4
by: wqyuwss | last post by:
Hi, We have several core dumps in our product. These core dump can be reproduced in the same place. That is system function call std::basic_istream<char,std::char_traits<char>>::getline. The...
1
by: atomik.fungus | last post by:
Hi, as many others im making my own matrix class, but the compiler is giving me a lot of errors related to the friend functions which overload >> and <<.I've looked around and no one seems to get...
2
by: Bit Byter | last post by:
I have a method in a class implemented like this: int foo (const char* filename, bool flg) { FILE *fp; char *buffer, *tokstr, *tmp; size_t size, toksize; unsigned int i; if ((fp =...
24
by: Noah Roberts | last post by:
Item #1 in the More Exceptional C++ book uses the following construct: fstream in; .... process( in.is_open() ? in : cin,...); Where process has been shown as having various multiple...
12
by: Kira Yamato | last post by:
I've posted this in another thread, but I suppose I should've started a new thread for it instead. I cannot get the following short program to compile under g++: #include <iostream> #include...
2
by: yalbizu | last post by:
#include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; const int NO_OF_STUDENTS=20; struct studentType { string studentFName; string studentLName;
2
Schwack
by: Schwack | last post by:
I've just started learning C++ (got bored at work) and I'm using VC++ to compile some simple code but I get a compile error in test.cpp when using "getline". I've searched the internet and this...
2
by: zelmila19 | last post by:
Hi am working on this program that will display the sum, difference, product and quotient of two numbers using the selection structures. This is what I did: #include <iostream> using...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.