Discussion:
error LNK2019: unresolved external symbol
(too old to reply)
lalo
2006-07-26 17:13:22 UTC
Permalink
Hi,
I spent the day trying to fix this error LNK2019 of unresolved external
symbol.
I tryed all the different tricks I found on the web, but nothing worked
out.
It as something to do with the stl library.
I found on my computer different versions of <string> <iostream>...
Which ones are the right one?
Note : the program build when I try to make a .lib and not a .exe

Here are the exact error messages:

Linking...
ipl98_visualc.lib(complex_image.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
std::operator<<<char,struct std::char_traits<char> >(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const
*)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
referenced in function __ehhandler$??***@ipl@@***@XZ
ipl98_visualc.lib(byte_image.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<<char,struct
std::char_traits<char> >(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(ipl98_general_functions.obj) : error LNK2001:
unresolved external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
std::operator<<<char,struct std::char_traits<char> >(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const
*)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(int_image.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<<char,struct
std::char_traits<char> >(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(float_image.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<<char,struct
std::char_traits<char> >(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(image.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<<char,struct
std::char_traits<char> >(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(std_image.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<<char,struct
std::char_traits<char> >(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(palette.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<<char,struct
std::char_traits<char> >(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(text.obj) : error LNK2001: unresolved external symbol
"__declspec(dllimport) class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<<char,struct
std::char_traits<char> >(class std::basic_ostream<char,struct
std::char_traits<char> > &,char const *)"
(__imp_??$?6DU?$***@D@std@@@std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@***@Z)
ipl98_visualc.lib(ipl98_general_functions.obj) : error LNK2019:
unresolved external symbol "__declspec(dllimport) public: char *
__thiscall std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::end(void)"
(__imp_?end@?$***@DU?$***@D@std@@V?$***@D@2@@std@@QAEPADXZ)
referenced in function "bool __cdecl ipl::ConvertBackslashToSlash(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > &)"
(?***@ipl@@YA_NAAV?$***@DU?$***@D@std@@V?$***@D@2@@std@@@Z)
ipl98_visualc.lib(ipl98_general_functions.obj) : error LNK2019:
unresolved external symbol "__declspec(dllimport) public: char *
__thiscall std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::begin(void)"
(__imp_?begin@?$***@DU?$***@D@std@@V?$***@D@2@@std@@QAEPADXZ)
referenced in function "bool __cdecl ipl::ConvertBackslashToSlash(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > &)"
(?***@ipl@@YA_NAAV?$***@DU?$***@D@std@@V?$***@D@2@@std@@@Z)
ipl98_visualc.lib(ipl98_general_functions.obj) : error LNK2019:
unresolved external symbol "__declspec(dllimport) public: char const *
__thiscall std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::end(void)const "
(__imp_?end@?$***@DU?$***@D@std@@V?$***@D@2@@std@@QBEPBDXZ)
referenced in function "int __cdecl ipl::CompareNoCase(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &,class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(?***@ipl@@YAHABV?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
ipl98_visualc.lib(ipl98_general_functions.obj) : error LNK2019:
unresolved external symbol "__declspec(dllimport) public: char const *
__thiscall std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::begin(void)const "
(__imp_?begin@?$***@DU?$***@D@std@@V?$***@D@2@@std@@QBEPBDXZ)
referenced in function "int __cdecl ipl::CompareNoCase(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &,class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)"
(?***@ipl@@YAHABV?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) private: void __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Copy(unsigned int)"
(__imp_?_Copy@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
referenced in function "public: class ipl::CCameraFirewireCMU &
__thiscall ipl::CCameraFirewireCMU::operator=(class
ipl::CCameraFirewireCMU const &)"
(??***@ipl@@***@ABV01@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) private: void __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Tidy(bool)"
(__imp_?_Tidy@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
referenced in function "public: class ipl::CCameraFirewireCMU &
__thiscall ipl::CCameraFirewireCMU::operator=(class
ipl::CCameraFirewireCMU const &)"
(??***@ipl@@***@ABV01@@Z)
cameras_ipl98.lib(cameras.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) private: void __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Tidy(bool)"
(__imp_?_Tidy@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) void __cdecl std::_Xlen(void)"
(__imp_?***@std@@YAXXZ) referenced in function "public: class
ipl::CCameraFirewireCMU & __thiscall
ipl::CCameraFirewireCMU::operator=(class ipl::CCameraFirewireCMU const
&)" (??***@ipl@@***@ABV01@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) char const `private: static char
const * __cdecl std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char>
cameras_ipl98.lib(cameras.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) char const `private: static char const *
__cdecl std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Nullstr(void)'::`2'::_C"
(__imp_?_C@?1??_Nullstr@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@4DB)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) private: void __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Eos(unsigned int)"
(__imp_?_Eos@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
referenced in function "public: class ipl::CCameraFirewireCMU &
__thiscall ipl::CCameraFirewireCMU::operator=(class
ipl::CCameraFirewireCMU const &)"
(??***@ipl@@***@ABV01@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) private: bool __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Grow(unsigned int,bool)"
(__imp_?_Grow@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
referenced in function "public: class ipl::CCameraFirewireCMU &
__thiscall ipl::CCameraFirewireCMU::operator=(class
ipl::CCameraFirewireCMU const &)"
(??***@ipl@@***@ABV01@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) private: void __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Split(void)"
(__imp_?_Split@?$***@DU?$***@D@std@@V?$***@D@2@@std@@AAEXXZ)
referenced in function "public: class ipl::CCameraFirewireCMU &
__thiscall ipl::CCameraFirewireCMU::operator=(class
ipl::CCameraFirewireCMU const &)"
(??***@ipl@@***@ABV01@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) void __cdecl std::_Xran(void)"
(__imp_?***@std@@YAXXZ) referenced in function "public: class
ipl::CCameraFirewireCMU & __thiscall
ipl::CCameraFirewireCMU::operator=(class ipl::CCameraFirewireCMU const
&)" (??***@ipl@@***@ABV01@@Z)
cameras_ipl98.lib(camera_firewire_cmu.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?$***@DU?$***@D@std@@@***@AAV10@***@Z)
referenced in function "public: __thiscall
ipl::CCameraFirewireCMU::~CCameraFirewireCMU(void)"
(??***@ipl@@***@XZ)
cameras_ipl98.lib(cameras.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?$***@DU?$***@D@std@@@***@AAV10@***@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) public: __thiscall
std::basic_ostream<char,struct std::char_traits<char>
cameras_ipl98.lib(cameras.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) public: __thiscall
std::basic_ostream<char,struct std::char_traits<char>
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) bool __cdecl
std::operator==(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(__imp_??8std@@YA_NABV?$***@DU?$***@D@std@@V?$***@D@2@@***@0@Z)
referenced in function "public: bool __thiscall
ipl::CCameraFirewireCMU::SelectCameraName(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >)"
(?***@CCameraFirewireCMU@ipl@@QAE_NV?$***@DU?$***@D@std@@V?$***@D@2@@std@@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) private: int __thiscall
std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::_Mode(int)"
(__imp_?_Mode@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
referenced in function "public: unsigned int __thiscall
ipl::CCameraFirewireCMU::GetTotalCameras(void)"
(?***@CCameraFirewireCMU@ipl@@QAEIXZ)
cameras_ipl98.lib(cameras.obj) : error LNK2001: unresolved external
symbol "__declspec(dllimport) private: int __thiscall
std::basic_stringbuf<char,struct std::char_traits<char>,class
std::allocator<char> >::_Mode(int)"
(__imp_?_Mode@?$***@DU?$***@D@std@@V?$***@D@2@@std@@***@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl std::operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??6std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@ABV?$***@DU?$***@D@std@@V?$***@D@2@@0@@Z)
referenced in function "public: bool __thiscall
ipl::CCameraFirewireCMU::GetAllCameraInfo(class std::vector<class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >,class std::allocator<class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > > > &)"
(?***@CCameraFirewireCMU@ipl@@QAE_NAAV?$***@V?$***@DU?$***@D@std@@V?$***@D@2@@std@@V?$***@V?$***@DU?$***@D@std@@V?$***@D@2@@std@@@2@@std@@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) public: class
std::basic_filebuf<char,struct std::char_traits<char> > * __thiscall
std::basic_filebuf<char,struct std::char_traits<char> >::open(char
const *,int)"
(__imp_?open@?$***@DU?$***@D@std@@@std@@***@PBDH@Z)
referenced in function "public: bool __thiscall
ipl::CCameraFirewireCMU::Save(char const *)const "
(?***@CCameraFirewireCMU@ipl@@***@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "class std::basic_istream<char,struct
std::char_traits<char> > & __cdecl std::operator>>(class
std::basic_istream<char,struct std::char_traits<char> > &,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > &)"
(??5std@@YAAAV?$***@DU?$***@D@std@@@***@AAV10@AAV?$***@DU?$***@D@std@@V?$***@D@2@@0@@Z)
referenced in function "class std::basic_istream<char,struct
std::char_traits<char> > & __cdecl ipl::operator>>(class
std::basic_istream<char,struct std::char_traits<char> > &,class
ipl::CCameraFirewireCMU &)"
(??5ipl@@YAAAV?$***@DU?$***@D@std@@@std@@***@AAVCCameraFirewireCMU@0@@Z)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > __cdecl
std::operator+(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??Hstd@@YA?AV?$***@DU?$***@D@std@@V?$***@D@2@@***@ABV10@***@Z)
referenced in function "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > __thiscall
ipl::CCameraFirewireCMU::GetModeName(void)const "
(?***@CCameraFirewireCMU@ipl@@QBE?AV?$***@DU?$***@D@std@@V?$***@D@2@@std@@XZ)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > __cdecl
std::operator+(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,char const
*)"
(??Hstd@@YA?AV?$***@DU?$***@D@std@@V?$***@D@2@@***@ABV10@***@Z)
referenced in function "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > __thiscall
ipl::CCameraFirewireCMU::GetModeName(void)const "
(?***@CCameraFirewireCMU@ipl@@QBE?AV?$***@DU?$***@D@std@@V?$***@D@2@@std@@XZ)
cameras_ipl98.lib(camera_firewire_cmu.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) bool __cdecl
std::operator!=(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(__imp_??9std@@YA_NABV?$***@DU?$***@D@std@@V?$***@D@2@@***@0@Z)
referenced in function "protected: bool __thiscall
ipl::CCameraFirewireCMU::GetCameraVendorNameSerial(class
std::basic_istream<char,struct std::char_traits<char> > &,double
&,class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > &,class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > &,unsigned long
&)const "
(?***@CCameraFirewireCMU@ipl@@IBE_NAAV?$***@DU?$***@D@std@@@std@@AANAAV?$***@DU?$***@D@std@@V?$***@D@2@@***@2AAK@Z)

Thanks a lot for your help
Holger Grund
2006-07-27 07:16:44 UTC
Permalink
Post by lalo
I spent the day trying to fix this error LNK2019 of unresolved external
symbol.
I tryed all the different tricks I found on the web, but nothing worked
out.
It as something to do with the stl library.
I found on my computer different versions of <string> <iostream>...
Which ones are the right one?
The ones that are installed with your compiler.
Post by lalo
Note : the program build when I try to make a .lib and not a .exe
Do you say you build a .lib file? The below output suggests otherwise.
Post by lalo
Linking...
ipl98_visualc.lib(complex_image.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
std::operator<<<char,struct std::char_traits<char> >(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const
*)"
All contributing object files must be compiled with the same compiler
and runtime library options. Has ipl98_visualc.lib been built with the
same compiler version as your other files?

Mixing different compiler versions inside a single module is not a
supported scenario in Visual C++.

-hg
lalo
2006-07-28 08:16:36 UTC
Permalink
Hi everyone,

Here are some more information about my system:
I am using the microsoft visual basic express.
I installed the microsoft sdk for my platform (windows xp pack 2)
I can find files like <string> either in the folder:
I copied for you the error when building a .exe because there were no
error when building a .lib
I can find for exemple on my computer the file in <iostream>
C:\Program Files\Microsoft Visual Studio 8\VC\include
and in
C:\Program Files\Microsoft SDK\Include\crt
and then choose in which folder the compiler should look for.
The error messages copied here are the ones using the microsoft sdk
folder.
I compiled ipl98_visualc.lib with the very same compiler (but not
cameras_ipl98.lib).
Does it help you to find where is the error?
Thanks again for your help
Post by Holger Grund
Post by lalo
I spent the day trying to fix this error LNK2019 of unresolved external
symbol.
I tryed all the different tricks I found on the web, but nothing worked
out.
It as something to do with the stl library.
I found on my computer different versions of <string> <iostream>...
Which ones are the right one?
The ones that are installed with your compiler.
Post by lalo
Note : the program build when I try to make a .lib and not a .exe
Do you say you build a .lib file? The below output suggests otherwise.
Post by lalo
Linking...
ipl98_visualc.lib(complex_image.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
std::operator<<<char,struct std::char_traits<char> >(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const
*)"
All contributing object files must be compiled with the same compiler
and runtime library options. Has ipl98_visualc.lib been built with the
same compiler version as your other files?
Mixing different compiler versions inside a single module is not a
supported scenario in Visual C++.
-hg
Holger Grund
2006-07-28 09:57:05 UTC
Permalink
Post by lalo
I am using the microsoft visual basic express.
I take it that is or includes Visual C++ 2005.
Post by lalo
I installed the microsoft sdk for my platform (windows xp pack 2)
Excellent. But you should need that for using Windows specific
functionality only. The <string> header is part of the C++.
That's because the Platform SDK includes the full C++
toolchain. When you build from within the IDE it uses
the headers from its own installation (Visual Studio, that is).
You could change these settings in Tool->Options->Project
->Directories, but you should _not_ do so in your case.
Post by lalo
I copied for you the error when building a .exe because there were no
error when building a .lib
Yes, my bad. I misread your explanation. You need to understand
what happens when building a library (.lib) or a fully linked image
(.exe or .dll).

A library is effectively a collection of object files (you can think of
it as a TAR file with symbol table). So when you build a .lib then
linker does not kick in at all.

When you build an image (.exe or .dll) the linker recursively
resolves references from your object files and select object files
from your libraries to satisfy these references.
Post by lalo
I can find for exemple on my computer the file in <iostream>
C:\Program Files\Microsoft Visual Studio 8\VC\include
and in
C:\Program Files\Microsoft SDK\Include\crt
and then choose in which folder the compiler should look for.
The error messages copied here are the ones using the microsoft sdk
folder.
You should use the standard setting (Visual Studio). But it probably
doesn't make a difference. Anyway you should always use the
binaries, libraries and headers from a single toolchain (either
use the PSDK compiler and headers or use Visual Studio
compiler and headers)
Post by lalo
I compiled ipl98_visualc.lib with the very same compiler (but not
cameras_ipl98.lib).
All of your contributing libraries and object files should be built
with the same compiler version and settings.

However, the error message suggests otherwise.

What it says is:

The linker selects complex_image.obj from ipl98_visualc.lib to
satisfy some other reference. complex_image.cpp (or whatever
source file was used to build complex_image.obj) references

std::operator<< <>( std::ostream&, const char*)

(That's required if you do something like std::cout << "snoopy")

which was declared as __declspec(dllimport).

That really suggest that it was not built with correct header files
because this operator is never imported in Visual C++ 2005
but is always inline regardless of the runtime library linkage
model.

So the question is: how do you build complex_image.obj?

-hg
Ulrich Eckhardt
2006-07-27 07:17:29 UTC
Permalink
Post by lalo
I spent the day trying to fix this error LNK2019 of unresolved external
symbol.
How did you get to this error in the first place? Show the code, tell us
about the project settings and what compiler and target you use.
Post by lalo
It as something to do with the stl library.
You mean the C++ standardlibrary. The STL (the final L already stands for
library) is obsolete since large parts were incorporated into the C++
standardlib. But that just for your info.
Post by lalo
I found on my computer different versions of <string> <iostream>...
Which ones are the right one?
Your compiler should know, unless you messed up the settings.
Post by lalo
ipl98_visualc.lib(complex_image.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
std::operator<<<char,struct std::char_traits<char> >(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const
*)"
That is the definition of

ostream& operator<<( ostream&, char const*);

that is missing. The only way I can imagine to get this error is to
explicitly not link to the C++ standardlibrary, but that requires some
effort.

Again, what exactly did you do in order to produce this problem in the first
place.

Uli
Chris
2006-07-27 22:22:24 UTC
Permalink
Turn off the compiler option "treat wchar_t as built in type" and
commit this fix to memory...it is a pain when you forget it.
Post by Ulrich Eckhardt
Post by lalo
I spent the day trying to fix this error LNK2019 of unresolved external
symbol.
How did you get to this error in the first place? Show the code, tell us
about the project settings and what compiler and target you use.
Post by lalo
It as something to do with the stl library.
You mean the C++ standardlibrary. The STL (the final L already stands for
library) is obsolete since large parts were incorporated into the C++
standardlib. But that just for your info.
Post by lalo
I found on my computer different versions of <string> <iostream>...
Which ones are the right one?
Your compiler should know, unless you messed up the settings.
Post by lalo
ipl98_visualc.lib(complex_image.obj) : error LNK2019: unresolved
external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
std::operator<<<char,struct std::char_traits<char> >(class
std::basic_ostream<char,struct std::char_traits<char> > &,char const
*)"
That is the definition of
ostream& operator<<( ostream&, char const*);
that is missing. The only way I can imagine to get this error is to
explicitly not link to the C++ standardlibrary, but that requires some
effort.
Again, what exactly did you do in order to produce this problem in the first
place.
Uli
lalo
2006-07-28 08:18:23 UTC
Permalink
Post by Chris
Turn off the compiler option "treat wchar_t as built in type" and
commit this fix to memory...it is a pain when you forget it.
I tried to do that : it did not change anything.
Thanks helene
lalo
2006-07-28 08:25:58 UTC
Permalink
Hi,

Here are the command lines for the compilation of the programm:
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "#define NOMINMAX" /D
"_AFXDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Zc:wchar_t-
/Yu"stdafx.h" /Fp"Debug\essai_acquisition2.pch" /Fo"Debug\\"
/Fd"Debug\vc80.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

Here are the command line for linking:
/OUT:"C:\Documents and Settings\hdelanoe\Mes documents\Visual Studio
2005\Projects\essai_acquisition2\Debug\essai_acquisition2.exe" /NOLOGO
/MANIFEST
/MANIFESTFILE:"Debug\essai_acquisition2.exe.intermediate.manifest"
/NODEFAULTLIB:"msvcrt.lib" /DEBUG /PDB:"c:\Documents and
Settings\hdelanoe\Mes documents\Visual Studio
2005\Projects\essai_acquisition2\debug\essai_acquisition2.pdb"
/SUBSYSTEM:CONSOLE /MACHINE:X86 /ERRORREPORT:PROMPT " ipl98_visualc.lib
1394camera.lib cameras_ipl98.lib


Here is the main code of the programm:
// essai_acquisition2.cpp : Defines the entry point for the console
application.
//

#include "stdafx.h"
#include <camera/camera_firewire/camera_firewire_cmu.h>
#include <ipl98/cpp/image.h>
#include <camera/camera_firewire/cmu/1394Camera.h>

#include <string>
#include <ostream>
#include <istream>
#include <iostream>
#include <limits>
#include <cctype>
#include <sstream>
#include <cstdio>
#include <sstream>


using namespace ipl;
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
if (argc!=2)
{
////cout << "ERROR - needs number of image to grab as argument" <<
endl;
return 1;
}
unsigned int TotalImages;
//sscanf(argv[1],"%d",&TotalImages);
//cout << "Total images to grab: " << TotalImages << endl;
CImage Img;
ostringstream ost;
CCameraFirewireCMU Cam;

Cam.Initialize();
//cout << endl << "Camera successfully selected, current settings: "
<< endl;
Cam.GetCurrentSettings(ost);
//cout << ost.str() << endl;
ost.str("");
string FilePrefix("Image_");
// grab image from each camera
for(int i=0; i<TotalImages;i++)
{
Cam.Acquire(Img);
//ost << FilePrefix << setfill('0') << std::setw(4) << i << ".bmp";
//Img.Save(ost.str().c_str());
//cout << "Saved image: " << ost.str() << endl;
//ost.str("");
}
//std::cout << "Finished...(press return)" << std::endl;
if (getchar()){}
return true;
}
Post by Ulrich Eckhardt
That is the definition of
ostream& operator<<( ostream&, char const*);
that is missing. The only way I can imagine to get this error is to
explicitly not link to the C++ standardlibrary, but that requires some
effort.
I thought this definition was included in <ostream> which is called
(see program above)
here what my <ostream> says
#ifdef _DLL
#pragma warning(disable:4231) /* the extern before template is a
non-standard extension */

extern template _CRTIMP basic_ostream<char, char_traits<char> >&
__cdecl operator<<(
basic_ostream<char, char_traits<char> >&, const char *);
extern template _CRTIMP basic_ostream<char, char_traits<char> >&
__cdecl operator<<(
basic_ostream<char, char_traits<char> >&, char);
extern template _CRTIMP basic_ostream<char, char_traits<char> >&
__cdecl operator<<(
basic_ostream<char, char_traits<char> >&, const signed char *);
extern template _CRTIMP basic_ostream<char, char_traits<char> >&
__cdecl operator<<(
basic_ostream<char, char_traits<char> >&, const signed char);
extern template _CRTIMP basic_ostream<char, char_traits<char> >&
__cdecl operator<<(
basic_ostream<char, char_traits<char> >&, const unsigned char
*);
extern template _CRTIMP basic_ostream<char, char_traits<char> >&
__cdecl operator<<(
basic_ostream<char, char_traits<char> >&, const unsigned char);
extern template _CRTIMP basic_ostream<wchar_t, char_traits<wchar_t> >&
__cdecl operator<<(
basic_ostream<wchar_t, char_traits<wchar_t> >&, const wchar_t
*);
extern template _CRTIMP basic_ostream<wchar_t, char_traits<wchar_t> >&
__cdecl operator<<(
basic_ostream<wchar_t, char_traits<wchar_t> >&, wchar_t);
extern template _CRTIMP basic_ostream<wchar_t, char_traits<wchar_t> >&
__cdecl operator<<(
basic_ostream<wchar_t, char_traits<wchar_t> >&, const signed
short *);

#pragma warning(default:4231) /* restore previous warning */
#endif // _DLL

Thanks again
Helene
Ulrich Eckhardt
2006-08-01 07:28:21 UTC
Permalink
Post by lalo
/D "#define NOMINMAX"
^^^^^^^^^^^^^^^^ ????
Post by lalo
/NODEFAULTLIB:"msvcrt.lib"
You shouldn't do such things unless you really know what you are doing.

[...code...]

That's not a minimal example as is customary for posting on the Usenet.

Uli

Continue reading on narkive:
Search results for 'error LNK2019: unresolved external symbol' (Questions and Answers)
3
replies
LNK 2019 : Unresolved Externals Error?
started 2011-02-25 22:33:16 UTC
programming & design
Loading...