Linker errors when using yaml-cpp 0.5 DLL - c++

I've got a C++ project in Visual Studio 2010 where I'm porting my code from the old yaml-cpp 0.3 API to the new 0.5 API. I've set up Boost, built the new DLLs with CMake, set up the include and library paths, updated all the code to match the new API, and everything compiles fine.
However, when it reaches linking, I'm met with a barrage of linker errors like this:
error LNK2001: unresolved external symbol "public: static bool __cdecl YAML::convert<bool>::decode(class YAML::Node const &,bool &)"
error LNK2001: unresolved external symbol "private: void __thiscall YAML::detail::node_data::insert_map_pair(class YAML::detail::node &,class YAML::detail::node &)"
error LNK2001: unresolved external symbol "public: void __thiscall YAML::detail::memory_holder::merge(class YAML::detail::memory_holder &)"
error LNK2001: unresolved external symbol "public: class YAML::detail::node & __thiscall YAML::detail::memory::create_node(void)"
error LNK2001: unresolved external symbol "public: void __thiscall YAML::detail::node_data::mark_defined(void)"
error LNK2001: unresolved external symbol "public: void __thiscall YAML::detail::node_data::set_null(void)"
...
It looks like not all symbols are being exported to the DLL, but I don't know how to fix it. I've tried cleaning everything, rebuilding, Debug/Release, different VS versions, etc. With yaml-cpp 0.3 it all worked fine, but I really want the new API. These are the settings I'm using in CMake to build the library:
APPLE_UNIVERSAL_BIN = false
BUILD_SHARED_LIBS = true
MSVC_SHARED_RT = true
MSVC_STHREADED_RT = false
YAML_CPP_BUILD_CONTRIB = false
YAML_CPP_BUILD_TOOLS = false

This is a known issue. You can follow the issue page on the project's page.

Related

Linking error using soci 3.2.3 instead of 3.2.2

I have a project which uses soci for DB access. The project was originally developed with soci 3.2.2.
Now I switched to soci 3.2.3 and get the following linker error messages:
error LNK2001: unresolved external symbol "public: class soci::details::once_temp_type & __thiscall soci::details::once_temp_type::operator,(class soci::details::type_ptr<class soci::details::use_type_base> const &)" (??Qonce_temp_type#details#soci##QAEAAV012#ABV?$type_ptr#Vuse_type_base#details#soci###12##Z)
error LNK2001: unresolved external symbol "public: void __thiscall soci::details::statement_impl::exchange_for_rowset(class soci::details::type_ptr<class soci::details::into_type_base> const &)" (?exchange_for_rowset#statement_impl#details#soci##QAEXABV?$type_ptr#Vinto_type_base#details#soci###23##Z)
error LNK2001: unresolved external symbol "public: class soci::details::prepare_temp_type & __thiscall soci::details::prepare_temp_type::operator,(class soci::details::type_ptr<class soci::details::use_type_base> const &)" (??Qprepare_temp_type#details#soci##QAEAAV012#ABV?$type_ptr#Vuse_type_base#details#soci###12##Z)
I use Visual Studio 2010 on a Windows machine.
Does somebody has an idea what could be the issue?
Bests
The Solution was using the newest error corrected Soci library from github and not the stable download version.
Bests

Strange LNK2001 linker error

Yesterday I got this linker error. I have searched on google and msdn without success.
My problem:
I have moved some parts of my cpp project in a extern static library. I added the h file to my main project and added the dependencies to the lib files. Unfortunately I get a lot linker errors.
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NFile::NFind::CFileInfo::Find(unsigned short const *)" (?Find#CFileInfo#NFind#NFile#NWindows##QAE_NPBG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: class NWindows::NCOM::CPropVariant & __thiscall NWindows::NCOM::CPropVariant::operator=(unsigned short const *)" (??4CPropVariant#NCOM#NWindows##QAEAAV012#PBG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CInFileStream::Open(unsigned short const *)" (?Open#CInFileStream##QAE_NPBG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NFile::NIO::COutFile::Create(unsigned short const *,bool)" (?Create#COutFile#NIO#NFile#NWindows##QAE_NPBG_N#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "void __cdecl ConvertUInt32ToString(unsigned int,unsigned short *)" (?ConvertUInt32ToString##YAXIPAG#Z)
1>Compressor.obj : error LNK2001: unresolved external symbol "public: bool __thiscall NWindows::NDLL::CLibrary::Load(unsigned short const *)" (?Load#CLibrary#NDLL#NWindows##QAE_NPBG#Z)
All this methods a part of my extern lib. I have tries a lot of compiler settings without success.
Further more when I remove the lib dependencie completely from the linker I get 26 LNK2001 error. So the linker finds only "parts" of the lib.
Do I use a wrong compiler / linker option for my projects?
edit:
The problem was the parameter define LPCTSTR of the method CLibrary::Load(LPCTSTR fileName). In my lib I set the option "Treat wchar_t as build-in type (Properties->C/C++->Lanuage-> ... ) to No. And now it works.
There's not enough information in the question so my answer merely serves as a guide.
Take one function, for instance bool NWindows::NFile::NFind::CFileInfo::Find(unsigned short const *) and find definition of it in your code. Is it there? With this exact function signature? Is it in unnamed namespace? Is it declared static in source file?
Also, try full rebuild of everything. You'd be surprised how many times full rebuild makes mysterious problems go away.

Bullet Physics Engine static library installation issues

hey so i just downloaded bullet 2.78, and took the following steps:
unziped and found this tutorial
followed the steps exactly for Cmake, except i found the pictures in the tutorial had some things checked like INSTALL LIBS and i didn't so I ended up checking EVERYTHING possible.
Went into the newly generated BULLET_PHYSICS.vcxproj and built it under debug and release
Saw i had a bunch of new libs in the lib folder in msvn/BulletBuild/lib but did nothing with them
Followed the rest of the steps in the tutorial exactly for setting up the actual project
Tried to build the last line of code: FAIL
Wondered Do i NEED the dlls, because only .libs and pdbs showed up in the lib folder, and the tutorial didn't mention em
My only experience in rebuilding libraries is through SFML by building its msvn files included in the download and using the resulting dynamic lib and dll files. The instructions in the tutorial are very different however. (If someone could explain to me how this works it would be GREAT)
I followed the instructions exactly, multiple times but i'm not sure what i'm missing. The build works if i comment out the line of code in main but keep the include, but when i keep it i get this:
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "void * __cdecl btAlignedAllocInternal(unsigned int,int)" (?btAlignedAllocInternal##YAPAXIH#Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "void __cdecl btAlignedFreeInternal(void *)" (?btAlignedFreeInternal##YAXPAX#Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexInternalShape::getAabbSlow(class btTransform const &,class btVector3 &,class btVector3 &)const " (?getAabbSlow#btConvexInternalShape##UBEXABVbtTransform##AAVbtVector3##1#Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall btCollisionShape::serialize(void *,class btSerializer *)const " (?serialize#btCollisionShape##UBEPBDPAXPAVbtSerializer###Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: __thiscall btPolyhedralConvexShape::btPolyhedralConvexShape(void)" (??0btPolyhedralConvexShape##QAE#XZ)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall btPolyhedralConvexShape::~btPolyhedralConvexShape(void)" (??1btPolyhedralConvexShape##UAE#XZ)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexInternalShape::setLocalScaling(class btVector3 const &)" (?setLocalScaling#btConvexInternalShape##UAEXABVbtVector3###Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,float &)const " (?getBoundingSphere#btCollisionShape##UBEXAAVbtVector3##AAM#Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc#btCollisionShape##UBEMXZ)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getContactBreakingThreshold(float)const " (?getContactBreakingThreshold#btCollisionShape##UBEMM#Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::serializeSingleShape(class btSerializer *)const " (?serializeSingleShape#btCollisionShape##UBEXPAVbtSerializer###Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btBoxShape::getAabb(class btTransform const &,class btVector3 &,class btVector3 &)const " (?getAabb#btBoxShape##UBEXABVbtTransform##AAVbtVector3##1#Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btBoxShape::calculateLocalInertia(float,class btVector3 &)const " (?calculateLocalInertia#btBoxShape##UBEXMAAVbtVector3###Z)
1>BulletTestApp.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall btPolyhedralConvexShape::initializePolyhedralFeatures(void)" (?initializePolyhedralFeatures#btPolyhedralConvexShape##UAE_NXZ)
1>C:\Libraries and Headers\Bullet\bullet-2.78\msvc\BulletTestApp\Release\BulletTestApp.exe : fatal error LNK1120: 14 unresolved externals
I know there's a link problem somewhere but i followed the instructions exactly so i don't know how to fix it. I don't see any additional dependencies when looking at the properties of the added projects if that's not how it's supposed to be... but I guess i don't understand this method of using a library in the first place though so that knowledge would help.
Alright, so apparently right clicking my TestBulletApp project and clicking 'Project Dependencies' was where i went wrong. msVS++ 2010 left the option there for some reason even though it
doesn't work to do it that way.
Instead to make the project dependent on the other projects in the solution you have to right click on your project like my "TestBulletApp" and go to Properties->Common Properties->Framework and References->Add New Reference" and add the depended on static library projects already added to the sollution such as 'bulletCollision' or whatever; also check that "Link Library Dependencies" is True on the right hand side.
So yeah thanks for the heads up guys..... 'cough' 'cough' =)

Linking to V8 does not work in release mode

I built the v8 libraries on visual studio 2005 in release mode, put the resulting .lib files (in release mode) and compiled my project against them.
While everything is working fine in debug mode (compiling and running correctly), in release mode I get the following link errors (as if the lib files are not there).
error LNK2001: unresolved external symbol "public: class v8::Local<class v8::Boolean> __thiscall v8::Value::ToBoolean(void)const " (?ToBoolean#Value#v8##QBE?AV?$Local#VBoolean#v8###2#XZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsInt32(void)const " (?IsInt32#Value#v8##QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsNumber(void)const " (?IsNumber#Value#v8##QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsBoolean(void)const " (?IsBoolean#Value#v8##QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsObject(void)const " (?IsObject#Value#v8##QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsArray(void)const " (?IsArray#Value#v8##QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsFunction(void)const " (?IsFunction#Value#v8##QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsNull(void)const " (?IsNull#Value#v8##QBE_NXZ)
My linker properties have the following additional depencies.
msvcrt.lib ntstc_msvcrt.lib Psapi.lib winmm.lib Ws2_32.lib $(SolutionDir)\external_libs\release\v8.lib
and my $(SolutionDir)\external_libs\release folder containst the files:
v8.lib, v8_base.lib, v8_snapshot.lib
Any help would be appreciated.
In Visual Studio the build options are separate for debug and release builds. You probably set everything up properly for debug mode, but not for release mode, hence the errors.
I forget exactly how things are layed out in VS2005, but in VS2008, there is a combobox at the top of the solution properties dialog that lets you choose between debug/release/all configurations.
In other words, you will have to add the additional dependencies to the linker properties section in release mode. Alternatively, in the future, make all changes with the configuration set to All configurations.
Likely cause: The command switches and defines you used to build the v8 lib don't match those that you are using to build the code consuming it.
As an aside, if you are using the vs2005 CRT, you don't need this: ntstc_msvcrt.lib
Martyn

VC++ 6 Linker Errors

Basically, what's happening is this: I have a VC6 workspace (contains 3 projects total), and after NOT being able to succesfully port it into VS2010, I installed XP on a virtual machine (Win 7 on host machine), and installed VS6 on the devbox.
From there, I was able to get past compilation errors, and land headfirst into a whole slew of linker errors...
and I have no idea what's wrong. If anyone could help me with this it would be tremendously appreciated!
(an excert from the build log, there's 41 linker errors total...)
>Linking...
MainFrm.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall ReportMenuBuilder::~ReportMenuBuilder(void)" (??1ReportMenuBuilder##UAE#XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: __thiscall ReportMenuBuilder::ReportMenuBuilder(void)" (??0ReportMenuBuilder##QAE#XZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: bool __thiscall ReportMenuBuilder::Build(bool)" (?Build#ReportMenuBuilder##QAE_N_N#Z)
MainFrm.obj : error LNK2001: unresolved external symbol "public: int __thiscall CReportMultiDocTemplate::GetDocumentCount(void)const " (?GetDocumentCount#CReportMultiDocTemplate##QBEHXZ)
MainFrm.obj : error LNK2001: unresolved external symbol "public: class CString __thiscall ReportMenuBuilder::GetFilespecGivenID(unsigned int)const " (?GetFilespecGivenID#ReportMenuBuilder##QBE?AVCString##I#Z)
Only thing I can think of is apparently the projects are having trouble seeing the necessary files from the other projects, but I don't know why.
My first guess would be you haven't added the .lib file to the additional imports of the other projects. If you have dumpbin the binaries and see if you see the export.