473,657 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error LNK2005: "class std::basic_istr eam

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(MS VCP80D.dll) : error LNK2005: "class
std::basic_istr eam<char,struct std::char_trait s<char & __cdecl
std::getline<ch ar,struct std::char_trait s<char>,class std::allocator< char>
>(class std::basic_istr eam<char,struct std::char_trait s<char &,class
std::basic_stri ng<char,struct std::char_trait s<char>,class
std::allocator< char &)"
(??$getline@DU? $char_traits@D@ std@@V?$allocat or@D@2@@std@@YA AAV?$basic_istr eam@DU?$char_tr aits@D@std@@@0@ AAV10@AAV?$basi c_string@DU?$ch ar_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 4139
>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
2724
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 <istream> #include <bits/char_traits.h>
4
4849
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 result of pstack for the core dump is > pstack core | c++filt
1
2128
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 the same error. Here is the code of the class template< class T > class Matrix { friend ostream &operator << <>( ostream &, const Matrix< T > & ); friend istream &operator >> <>( istream &, Matrix< T > & ); public: ...
2
6006
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 = fopen(filename, "r")) == NULL)
24
2133
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 different
12
2685
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 <fstream> #include <iterator> #include <algorithm>
2
14894
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
5290
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 forum but can't find an answer. I hope that someone can help :-) test.h: #include <iostream> #include <fstream> #include <string> using namespace std; class ReadFile
2
2227
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 std::cout; using std::cin; using std::endl; int num1 = 0;
0
8827
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.