Linking to V8 does not work in release mode - c++

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

Related

Error LNK2001: unresolved external symbol "public: __thiscall CBaseVideoRenderer

I am updating some old code. Everything compiled fine. But I am stuck on (I think) simple thing.
Error LNK2001: unresolved external symbol "public: __thiscall CBaseVideoRenderer"
I have built the latest DirectShow lib both in Unicode and MBCS. And it still gives me this compile error. It gives me no error in the code. What is here wrong?
EDIT:
Here is the file where CBaseVideoRendere.
https://github.com/pixelspark/tjshow/blob/master/ShowControl/TJShow/src/view/tjtexturerenderer.h
(I have updated the DirectShow. But it is not ready to go in the git. So there is a different version)

LNK2019 error using Nite and OpenNI

I haven't ever seen the error of LNK 2019 before and now I encounter it when i try to link the code that i get from Nite.
The error is...
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteShutdownHandTracker referenced in function "public: void __thiscall nite::HandTracker::destroy(void)" (?destroy#HandTracker#nite##QAEXXZ)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteStartHandTracking referenced in function "public: enum nite::Status __thiscall nite::HandTracker::startHandTracking(class nite::Point3f const &,short *)" (?startHandTracking#HandTracker#nite##QAE?AW4Status#2#ABVPoint3f#2#PAF#Z)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteReadHandTrackerFrame referenced in function "public: enum nite::Status __thiscall nite::HandTracker::readFrame(class nite::HandTrackerFrameRef *)" (?readFrame#HandTracker#nite##QAE?AW4Status#2#PAVHandTrackerFrameRef#2##Z)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteHandTrackerFrameRelease referenced in function "public: void __thiscall nite::HandTrackerFrameRef::release(void)" (?release#HandTrackerFrameRef#nite##QAEXXZ)
1>kinect.obj : error LNK2019: unresolved external symbol __imp__niteStartGestureDetection referenced in function "public: enum nite::Status __thiscall nite::HandTracker::startGestureDetection(enum nite::GestureType)" (?startGestureDetection#HandTracker#nite##QAE?AW4Status#2#W4GestureType#2##Z)
1>D:\AcerUser\Documents\Visual Studio 2013\Projects\kinect\Debug\kinect.exe : fatal error LNK1120: 11 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
how to solve it?
Thanks
If you get error LNK2019 from Visual Studio Console output, you might building your project for Win32 platform on your 64bit Windows, try swiching to x64.
IF you are Using Visual Studio GO TO ->Build --> (thats where you change or create win32/x64
Configuration Manager
Are you sure your application is being linked against the corresponding libraries?
Somewhere in your OpenNI and Nite installation, there must be a folder containing .lib files. You have to specify this path in the additional library directories in your project's property page. If it still doesn't work afterwards, you should add the names of these libraries in the additional dependencies.

Linker errors when using yaml-cpp 0.5 DLL

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.

Trying to use my project with external opencv

I'm attaching some external libraries to my project in C++.
These libraries make use of the opencv2 libraries.
I already added the opencv2 include files to my c/c++ properties. I also added all the relevant lib files which I googled and found to the Linker input list. (I'm running the release version, but I also tried the debug version with the "d" extension).
opencv_core230.lib
opencv_highgui230.lib
opencv_objdetect230.lib
opencv_imgproc230.lib
opencv_ml230.lib
opencv_legacy230.lib
opencv_video230.lib
I'm getting these 4 annoying linking problems regarding the setSVMDetector#HOGDescriptor.
I looked everywhere for a solution and couldn't find one.; no one really uses the setSVM function in the external program.
Here are the linking problems:
Error 14 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\GraspTestingTool.obj GraspTestingTool
Error 15 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\htmlGenerator.obj GraspTestingTool
Error 16 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\sequenceTests.obj GraspTestingTool
Error 17 error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV_InputArray#2##Z) C:\Users\idan\Documents\Visual Studio 2010\GraspTestingTool\GraspTestingTool\Utilities.obj GraspTestingTool
Does anyone know how to solve this issue?
Thanks a lot!
Error is due to not adding specifice library in debug or releas mode.
use 32 bit or 64 library depending on your target machine
Add respective library of opencv in release mode -
opencv_core242.lib opencv_highgui242.lib opencv_imgproc242.lib opencv_ml242.lib
opencv_legacy242.lib opencv_video242.lib
OR If you want run program in debug mode then
use debug lib of opencv
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
opencv_objdetect242.lib
C:\opencv\build\x86\vc10\lib
Add the library file "opencv_objdetect248.lib; opencv_objdetect248d.lib;" in Project roperties-->Linker-->Input.
You need to add opencv_objdetect library. If you using debug mode add objdetect(version)d.lib, however, if you release mode add objdetect(version).lib

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.