Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2007

Tip: Looking for answers? Try searching our database.

error LNK2005: "class std::basic_istream

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cleohm - 01 Feb 2007 09:07 GMT
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
David Lowndes - 01 Feb 2007 12:13 GMT
>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
cleohm - 01 Feb 2007 13:10 GMT
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?

> >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
[quoted text clipped - 9 lines]
>
> Dave
David Lowndes - 01 Feb 2007 15:01 GMT
>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
cleohm - 02 Feb 2007 13:06 GMT
Thanks!

> >Thanks for your reply.  In fact I have recompiled my library in vs 2005 which
> >was previously in vs2003, and it works.
[quoted text clipped - 14 lines]
>
> Dave

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.