So I am using PCL for point cloud stuff and OpenSceneGraph for visualization. PCL visualization is pretty bad so I made my own. Anyways whenever I try to use this statement
pcl::io::savePCDFileBinary<pcl::PointXYZRGBA>(fname2,*cloud);
things break and I get the following errors
osgDBd.lib(osg80-osgDBd.dll) : error LNK2005: "public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::close(void)" (?close#?$basic_ofstream#DU?$char_traits#D#std###std##QAEXXZ) already defined in Recorder.obj
2>osgDBd.lib(osg80-osgDBd.dll) : error LNK2005: "public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (??_D?$basic_ofstream#DU?$char_traits#D#std###std##QAEXXZ) already defined in Recorder.obj
2>osgDBd.lib(osg80-osgDBd.dll) : error LNK2005: "public: bool __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::is_open(void)const " (?is_open#?$basic_ofstream#DU?$char_traits#D#std###std##QBE_NXZ) already defined in Recorder.obj
2>osgDBd.lib(osg80-osgDBd.dll) : error LNK2005: "public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::open(char const *,int,int)" (?open#?$basic_ofstream#DU?$char_traits#D#std###std##QAEXPBDHH#Z) already defined in Recorder.obj
2>osgDBd.lib(osg80-osgDBd.dll) : error LNK2005: "public: __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::basic_ofstream<char,struct std::char_traits<char> >(void)" (??0?$basic_ofstream#DU?$char_traits#D#std###std##QAE#XZ) already defined in Recorder.obj
2>E:\Google Drive\Research\PCL\build\HandTracker\Debug\HandTracker.exe : fatal error LNK1169: one or more multiply defined symbols found
I know that IO files in OSG and PCL are conflicting particularly ostream headers. My question is how do I fix this? I need to use this statement for intermediary files saves, logging, etc. so not using it is out of the question unless I want to use my own method which is kinda like reinventing the wheel.
Thanks for any help
http://forum.openscenegraph.org/viewtopic.php?t=8099
There are several solutions outlined there.
Related
i've downloaded and builded Boost 1.55 from source. I'm trying to use Boost-log. In basic case (http://boost-log.sourceforge.net/libs/log/doc/html)/log/tutorial.html#log.tutorial.trivial it's working fine without any problems, but when i try to use some more advanced features(like this - http://boost-log.sourceforge.net/libs/log/example/doc/tutorial_fmt_stream.cpp ) i'm getting this error:
main.obj : error LNK2019: unresolved external symbol "void __cdecl
boost::filesystem::path_traits::convert(char const *,char const
*,class std::basic_string,class std::allocator>
&,class std::codecvt const &)" (?convert#path_traits#filesystem#boost##YAXPBD0AAV?$basic_string#GU?$char_traits#G#std##V?$allocator#G#2##std##ABV?$codecvt#GDH#5##Z)
referenced in function "void __cdecl
boost::filesystem::path_traits::dispatch,class std::allocator > >(class
std::basic_string,class
std::allocator > const &,class std::basic_string,class
std::allocator > &,class std::codecvt const &)"
(??$dispatch#V?$basic_string#GU?$char_traits#G#std##V?$allocator#G#2##std###path_traits#filesystem#boost##YAXABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##AAV?$basic_string#GU?$char_traits#G#std##V?$allocator#G#2##4#ABV?$codecvt#GDH#4##Z)
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl
boost::log::v2s_mt_nt5::aux::code_convert(unsigned short const
*,unsigned int,class std::basic_string,class std::allocator > &,class
std::locale const &)"
(?code_convert#aux#v2s_mt_nt5#log#boost##YAXPBGIAAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##ABVlocale#6##Z)
referenced in function "private: void __thiscall
boost::log::v2s_mt_nt5::basic_formatting_ostream,class std::allocator>
::aligned_write(unsigned short const *,__int64)" (??$aligned_write#G#?$basic_formatting_ostream#DU?$char_traits#D#std##V?$allocator#D#2##v2s_mt_nt5#log#boost##AAEXPBG_J#Z)
1>main.obj : error LNK2019: unresolved external symbol "public: static
class std::codecvt const & __cdecl
boost::filesystem::path::codecvt(void)"
(?codecvt#path#filesystem#boost##SAABV?$codecvt#GDH#std##XZ)
referenced in function "public: __thiscall
boost::filesystem::path::path(char const (&)[14],void
*)" (??$?0$$BY0O#$$CBD#path#filesystem#boost##QAE#AAY0O#$$CBDPAX#Z)
So basically it can't find functions convert(...), code_convert(...) and codecvt(...) in .lib files.
I've already tried to add all release libraries (.lib files made while building boost) to "additional libraries" and generally i think that visual studio find all libraries, but can't find those functions in libraries. Any ideas how can i fix this?
I've build Boost 1.55 from source using visual studio 2010 (msvc10.0), 32 bit, release and debug. I'm working on windows 7 x64.
I had the same problem and I could fix it by changing one of the Project properties on VisualStudio 2010.
Go to:
Property Pages -> ConfigurationProperties -> C/C++ -> Language -> Treat WChar_t As Built in Type:
And set the property to:
Yes (/Zc:wchar_t)
I hope it will be helpful for you too :)
Take care,
I really hate this problem that the compiler tells me
"err LNK2019: Reference to unresolved external symbol".
Unlike other compiler errors, I can not jump to this problem by double-clicking it.
It always takes me a tremendous amount of time to figure out what I did wrong.
For example, from the error message
Error 9 error LNK2019: Reference to unresolved symbol ""public: class std::vector<unsigned char,class std::allocator<unsigned char> > & __thiscall clsJoinBigUnsignedCharMap::Content(void)" (?Content#clsJoinBigUnsignedCharMap##QAEAAV?$vector#EV?$allocator#E#std###std##XZ)" in Funktion ""private: void __thiscall CCompiler::pSerializeJoinBigUnsignedCharMap(class clsJoinBigUnsignedCharMap &,struct _iobuf *)" (?pSerializeJoinBigUnsignedCharMap#CCompiler##AAEXAAVclsJoinBigUnsignedCharMap##PAU_iobuf###Z)". m:\compiler.obj voice
I can not see at all where I should look for the error.
Am I missing something here? I don't see where the error is located, and the fact that I can not jump to the problem by double-clicking it indicates to me that VS2010 does not know either.
Thank you for the help.
Your CCompiler::pSerializeJoinBigUnsignedCharMap (from compiler.obj) is using a method (clsJoinBigUnsignedCharMap::Content()) that's defined in a header, but not implemented within any of the linked source files.
If you read the message it says:
in Funktion ""private: void __thiscall CCompiler::pSerializeJoinBigUnsignedCharMap(class clsJoinBigUnsignedCharMap &,struct _iobuf *)"
so in the function CCompiler::pSerializeJoinBigUnsignedCharMap,
there is a unreferenced symbol
clsJoinBigUnsignedCharMap::Content(void)
the linker cannot link with clsJoinBigUnsignedCharMap::Content, it has no compiled code for it.
I was trying to implement a protocol stack using Protocol Layer Design Pattern :
http://www.eventhelix.com/realtimemantra/patterncatalog/protocol_layer.htm
In our project,I have all the layers as separate dlls.
The layers that i have are:
Application Layer dll
LLC Layer dll
MAC Layer dll
Physical Layer dll
I have another project in the same solution which implements the Design Pattern and
has the implementations of the General functionalities of a protocol Layer.
All my layers are inheriting from the Protocol Layer Base class. The dependency between
projects is as follows:
Protocol Layer Design Pattern dll: No dependency
Physical Layer dll: Protocol Design Pattern dll
MAC Layer dll: Protocol Design Pattern dll and Physical Layer dll
LLC Layer dll: Protocol Design Pattern dll and MAC Layer dll
Application Layer dll: Protocol Design Pattern dll and LLC Layer dll
Based on the design pattern, each of our layer has pointers to the layer above and below it.
And the flow that we designed is like: In application layer constructor we create an object of
LLC Layer then LLC Layer creates Mac layer and MAC layer inturn creates physical Layer. They all are linked
using pointers.
My Protocol Design Pattern project dll and Physical Layer dll builds properly. But other dll builds are giving
linker error. Saying unresolved externals to the constructor of the underlying layer.
These are the errors which i am getting.
==================================
1>phLayer.obj : error LNK2019: unresolved external symbol "public:
virtual __thiscall CProtocolLayer::~CProtocolLayer(void)"
(??1CProtocolLayer##UAE#XZ) referenced in function
__unwindfunclet$??0CPhysicalLayer##QAE#PAVCProtocolLayer###Z$0 1>phLayer.obj : error LNK2019: unresolved external symbol "public:
__thiscall CReceiveProtocolHandler::CReceiveProtocolHandler(class CProtocolLayer *)"
(??0CReceiveProtocolHandler##QAE#PAVCProtocolLayer###Z) referenced
in function "public: __thiscall
CPhysicalLayer::CPhysicalLayer(class CProtocolLayer *)"
(??0CPhysicalLayer##QAE#PAVCProtocolLayer###Z) 1>phLayer.obj :
error LNK2019: unresolved external symbol "public: __thiscall
CTransmitProtocolHandler::CTransmitProtocolHandler(class
CProtocolLayer *)"
(??0CTransmitProtocolHandler##QAE#PAVCProtocolLayer###Z) referenced
in function "public: __thiscall CPhysicalLayer::CPhysicalLayer(class
CProtocolLayer *)" (??0CPhysicalLayer##QAE#PAVCProtocolLayer###Z)
1>phLayer.obj : error LNK2019: unresolved external symbol "public:
__thiscall CProtocolLayer::CProtocolLayer(class CProtocolLayer *,class CProtocolLayer *)" (??0CProtocolLayer##QAE#PAV0#0#Z) referenced in function "public: __thiscall
CPhysicalLayer::CPhysicalLayer(class CProtocolLayer *)"
(??0CPhysicalLayer##QAE#PAVCProtocolLayer###Z) 1>phLayer.obj : error
LNK2019: unresolved external symbol "public: int __thiscall
CProtocolPacket::getBodyLength(void)"
(?getBodyLength#CProtocolPacket##QAEHXZ) referenced in function
"public: virtual void __thiscall CPhysicalLayer::Data_req(class
CProtocolPacket *)"
(?Data_req#CPhysicalLayer##UAEXPAVCProtocolPacket###Z) 1>phLayer.obj
: error LNK2019: unresolved external symbol "public: void __thiscall
CReceiveProtocolHandler::Handle_Receive(class CProtocolPacket *)"
(?Handle_Receive#CReceiveProtocolHandler##QAEXPAVCProtocolPacket###Z)
referenced in function "private: void __thiscall
CPhysicalLayer::dataRead(void)" (?dataRead#CPhysicalLayer##AAEXXZ)
1>phLayer.obj : error LNK2019: unresolved external symbol "public:
void __thiscall CProtocolPacket::AddTrailer(int,char *)"
(?AddTrailer#CProtocolPacket##QAEXHPAD#Z) referenced in function
"private: class CProtocolPacket __thiscall
CPhysicalLayer::convertToProtocolPacket(class
std::basic_string,class
std::allocator >)"
(?convertToProtocolPacket#CPhysicalLayer##AAE?AVCProtocolPacket##V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>phLayer.obj : error LNK2019: unresolved external symbol "public:
void __thiscall CProtocolPacket::AddHeader(int,char *)"
(?AddHeader#CProtocolPacket##QAEXHPAD#Z) referenced in function
"private: class CProtocolPacket __thiscall
CPhysicalLayer::convertToProtocolPacket(class
std::basic_string,class
std::allocator >)"
(?convertToProtocolPacket#CPhysicalLayer##AAE?AVCProtocolPacket##V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
How are you building the exe? I see that, you are facing only linker issues. Either you must be linking in the wrong order or there must be something, which went wrong. Try to link them in a correct order. This should solve the problem. If not, please provide more information.
I am getting a bunch of linking errors while trying to link the release version of an executable(debug version does not have the same issue). Comparing the command line for the link does not reveal any issues.
there are broadly 2 types of errors neither of which I can get a handle on.
The first kind complains about a unresolved external symbol _declspec(dllimport)
As an example:
error LNK2019: unresolved external symbol
"_declspec(dllimport)
public: __thiscall
stlpd_std::basic_string,class stlpd_std::allocator >::basic_string,class stlpd_std::allocator >(class stlpd_std::basic_string,class stlpd_std::allocator > const &)" (_imp??0?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std##QAE#ABV01##Z) referenced in function "public: __thiscall Springfield::generic::runtime_error::runtime_error(class stlpd_std::basic_string,class stlpd_std::allocator > const &)" (??0runtime_error#generic#Springfield##QAE#ABV?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std###Z)
for a more human readable version(replacing all the strings):
error LNK2019: unresolved external symbol
"__declspec(dllimport)
public: __thiscall
string::basic_string,class stlpd_std::allocator >(class string const &)" (_imp??0?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std##QAE#ABV01##Z) referenced in function "public: __thiscall Springfield::generic::runtime_error::runtime_error(class string const &)" (??0runtime_error#generic#Springfield##QAE#ABV?$basic_string#DV?$char_traits#D#stlpd_std##V?$allocator#D#2##stlpd_std###Z
The sceond class of errors complains about
unresolved external symbol __CrtDbgReportW
I hope I can get some kind of insight in dealing with this.
From the errors it looks like you are not including the CRT as one of your linked libraries. Here is a link to the different CRT lib's offered in Visual Studio 2005. Choose the one which is most appropriate and make sure it's in the list of lib's to link against
http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx
It looks like you're either including a file that's been built using the debug settings or you're mixing runtime libraries (DLL and static).
I am using Visual C++ 2005 Express Edition and get the following linker errors:
19>mylib1.lib(mylibsource1.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::exception::_Raise(void)const " (__imp_?_Raise#exception#std##QBEXXZ) referenced in function "protected: static void __cdecl std::vector<class mytype,class std::allocator<class mytype> >::_Xlen(void)" (?_Xlen#?$vector#Vmytype##V?$allocator#Vmytype###std###std##KAXXZ)
19>mylib2.lib(mylibsource2.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::exception::_Raise(void)const " (__imp_?_Raise#exception#std##QBEXXZ)
19>mylib1.lib(mylibsource1.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const *,int)" (__imp_??0exception#std##QAE#PBDH#Z) referenced in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error#std##QAE#ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##1##Z)
19>mylib2.lib(mylibsource2.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const *,int)" (__imp_??0exception#std##QAE#PBDH#Z)
I turned off exceptions in generated code, and I am using before including the vector header file:
#define _HAS_EXCEPTIONS 0
A few Google results turned up some stuff, but no "aha!" solutions that worked for me.
EDIT:
As noted "_HAS_EXCEPTIONS 0" doesn't turn off exceptions, per se. What it does is, at least in the vector header file, is call _Raise on an exception object instead of calling the C++ "throw". In my case, it can't link to the exception object's _Raise function since I am not including the correct library. What that library is, though, is not obvious.
Adding this line:
#define _STATIC_CPPLIB
before including the vector header seems to do the trick.
The third error makes it clear that #define the _HAS_EXCEPTIONS 0 does not affect . Now, might include (makes sense, sharing code might reduce the size of your executable). That would explain why you still have errors if you define it before your inclusion of . This kind of defines should be done in your project settings.
Note that _HAS_EXCEPTIONS is an unsupported feature in Visual Studio. It does not turn off exceptions as such.