473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Receiving ostream linker errors from VC6 built library

I have a library that is built in VC6 which contains references to the new
iostream instead
of "iostream.h" to accomodate my .NET Studio built C++ application. However,
in debug mode, I
obtain the following linker warnings. The object files referenced are part
of the VC6 built libraries:

MiLibd.lib(MiInternetAddress.obj) : error LNK2019: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const *)"
(__imp_??6std@@YAAAV?$basic_ostream@DU?$char_trait s@D@std@@@0@AAV10@PBD@Z)
referenced in function "public: __thiscall
MiInternetAddress::MiInternetAddress(unsigned short)"
(??0MiInternetAddress@@QAE@G@Z)

MiLibd.lib(MiSocketInitializer.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const *)"
(__imp_??6std@@YAAAV?$basic_ostream@DU?$char_trait s@D@std@@@0@AAV10@PBD@Z)
Any ideas on what can cause the LINK2019 warnings for the basic_ostream
package after building
my VS.Net built c++ application. Are there signature differences that can
cause issues?

Would appreciate any form of an idea!!!

Thanks
Paul
Nov 17 '05 #1
1 1731
Paul Brun wrote:
I have a library that is built in VC6 which contains references to the new
iostream instead
of "iostream.h" to accomodate my .NET Studio built C++ application. However,
in debug mode, I
obtain the following linker warnings. The object files referenced are part
of the VC6 built libraries:

MiLibd.lib(MiInternetAddress.obj) : error LNK2019: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const *)"
(__imp_??6std@@YAAAV?$basic_ostream@DU?$char_trait s@D@std@@@0@AAV10@PBD@Z)
referenced in function "public: __thiscall
MiInternetAddress::MiInternetAddress(unsigned short)"
(??0MiInternetAddress@@QAE@G@Z)

MiLibd.lib(MiSocketInitializer.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const *)"
(__imp_??6std@@YAAAV?$basic_ostream@DU?$char_trait s@D@std@@@0@AAV10@PBD@Z)
Any ideas on what can cause the LINK2019 warnings for the basic_ostream
package after building
my VS.Net built c++ application. Are there signature differences that can
cause issues?


Yes. The VC7.1 version of the library is different from the VC6 one -
the two can't be mixed at all.

The easiest fix is to recompile your VC6 library under VC.NET. Failing
that, you'll have to write a wrapper library in VC6 that exposes a C or
COM interface, since neither of these interface types suffers from
versioning problems.

The moral is: don't use C++ classes (and particularly standard library
ones) in the interface of DLLs or binary libraries, since Microsoft's
C++ ABI is not stable between versions, particularly the standard
library ABI. If you want to use C++ in a library, make sure you supply
(possible obfuscated) source code so that it can be recompiled if necessary.

Tom
Nov 17 '05 #2

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

Similar topics

0
by: TGF | last post by:
Hello, I am creating a console app. I try to link a static library by including it in the Linker-Input-Additional Dependencies field under the Project properties. Then I specify the path to...
0
by: TGF | last post by:
Hello, I am creating a console app. I try to link a static library by including it in the Linker-Input-Additional Dependencies field under the Project properties. Then I specify the path to...
4
by: Saran | last post by:
Hi All, I'm getting the following linker error when I try to build a library. nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv nafxcw.lib(appcore.obj) : error...
2
by: Senapathy | last post by:
VC++ .NET 2003 Standard Edition Win XP, SP2 Hi, I have a code that builds under VC6.0, but fails to link in VC7.1. The offending code is as follows: _AFX_RICHEDIT_STATE* const pEditState...
3
by: Chucker | last post by:
Hi Folks, I got a Wrapper Dll around a native C++ static library. In .NET 1.1 this worked fine. When moving to .NET 2.0 I get a couple of unresolved externals / linker errors: Error 16 error...
1
by: Felix | last post by:
After porting a project from VC6 to VC.NET 2003 I have a very strange problem generating link error 1104 for import libraries. I just ported the project and made some small adaptions so it fits...
1
DeMan
by: DeMan | last post by:
I built a project using wxWidgets (2.8.3) using codeBlocks, with wxWidgets built MOLITHIC=1, SHARE=0, BUILD=debug and everything was fine and dandy (asside from the 25MB exe). I tried the same by...
2
by: Oneironaut | last post by:
Hello friends, I have an issue with a linker warning. It is the warning LNK4089. I am working in MSVC6.0 I investigated and this warning tells that the import of the library to which it makes...
2
by: Markus Dehmann | last post by:
What to do if an external library is header-files-only (but you have to use it), and you get lots of linker errors? You will necessarily get linker errors "multiple definition of ..." if you try...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...

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.