Point cloud library missing header files after vcpkg installation - vcpkg

I am quite a beginner to programming so I am sorry for my basic question.
I installed PCL 11.1 via vcpkg manager a few weeks ago and now I have realized I am missing some header files. In particular pcl/surface/concave_hull.h and some more regarding visualisation but these I don't miss that much for now.
I have tried to install PCL (v11.1) in a different way (using exe file which I found on git) and I can see the missing files there. Nevertheless when I add this location to additional include directories in visual studio (v16.8.4)I got 3 Linker errors.
Error LNK2001 unresolved external symbol "protected: virtual void __cdecl pcl::ConcaveHull<struct pcl::PointXYZ>::performReconstruction(struct pcl::PolygonMesh &)" (?performReconstruction#?$ConcaveHull#UPointXYZ#pcl###pcl##MEAAXAEAUPolygonMesh#2##Z) Meas3D C:\Users\hribh\source\repos\Meas3D\Meas3D\Meas3D\hull.obj 1
Error LNK2001 unresolved external symbol "protected: virtual void __cdecl pcl::ConcaveHull<struct pcl::PointXYZ>::performReconstruction(class std::vector<struct pcl::Vertices,class std::allocator<struct pcl::Vertices> > &)" (?performReconstruction#?$ConcaveHull#UPointXYZ#pcl###pcl##MEAAXAEAV?$vector#UVertices#pcl##V?$allocator#UVertices#pcl###std###std###Z) Meas3D C:\Users\hribh\source\repos\Meas3D\Meas3D\Meas3D\hull.obj 1
Error LNK2001 unresolved external symbol "public: void __cdecl pcl::ConcaveHull<struct pcl::PointXYZ>::reconstruct(class pcl::PointCloud<struct pcl::PointXYZ> &,class std::vector<struct pcl::Vertices,class std::allocator<struct pcl::Vertices> > &)" (?reconstruct#?$ConcaveHull#UPointXYZ#pcl###pcl##QEAAXAEAV?$PointCloud#UPointXYZ#pcl###2#AEAV?$vector#UVertices#pcl##V?$allocator#UVertices#pcl###std###std###Z) Meas3D C:\Users\hribh\source\repos\Meas3D\Meas3D\Meas3D\hull.obj 1
Does anybody know why is that and how to install complete version of PCL through vcpkg or how to get rid of those errors? Thank you.

I had the same issue with header files.
Turned out, that using vcpkg does not provide all the headers and files.
You can install pcl all in one from here, this solved my problem: http://unanancyowen.com/en/pcl181/
I know that it is a basic answer, but I hope it can help.

Related

FLAC++ Unresolved external symbols (FLAC::Encoder::Stream::State::resolved_as_cstring and FLAC::Encoder::Stream::operator bool(void) const)

I am trying to set up the FLAC++ to allow me to encode/decode audio data, but when I attempt to compile I get 2 unresolved external errors:
LNK2019 unresolved external symbol "__declspec(dllimport) public: char const * __cdecl FLAC::Encoder::Stream::State::resolved_as_cstring(class FLAC::Encoder::Stream const &)const " (_imp?resolved_as_cstring#State#Stream#Encoder#FLAC##QEBAPEBDAEBV234##Z) referenced in function "public: int __cdecl"
LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl FLAC::Encoder::Stream::operator bool(void)const " (_imp??BStream#Encoder#FLAC##QEBA_NXZ) referenced in function "public: int __cdecl"
I am linking both the FLAC.lib and FLAC++.lib files from program files (C:\Program Files (x86)\FLAC\lib).
I have tried installing 4 different versions of FLAC (1.3.3, 1.3.4, 1.4.0 and 1.4.1) but the linking errors still persist.
Does anyone have any suggestion to why this might be happening or what I might be missing here?
Thanks!
Edit: I am using Visual Studio 2022. I have ensured that CMake is configured to generate for Visual Studio 2022, and am compiling FLAC from the same version.
Edit 2: I have solved this by downloading the library from the latest GitHub commit from (https://github.com/xiph/flac). I am unsure why, but all stable releases seem to result in the same linking errors.

lnk2001 error in VS trying to use the Bullet physics library

I'm new to C++, Visual Studio (2019) and Bullet (2.89).
I've been tying to build the Hello_World.cpp from Bullet for the past few days but I'm stuck on these 5 linking errors:
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,float &)const " (?getBoundingSphere#btCollisionShape##UBEXAAVbtVector3##AAM#Z)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc#btCollisionShape##UBEMXZ)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual float __thiscall btCollisionShape::getContactBreakingThreshold(float)const " (?getContactBreakingThreshold#btCollisionShape##UBEMM#Z)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btConvexShape::project(class btTransform const &,class btVector3 const &,float &,float &,class btVector3 &,class btVector3 &)const " (?project#btConvexShape##UBEXABVbtTransform##ABVbtVector3##AAM2AAV3#3#Z)
1>Hello_World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btSphereShape::calculateLocalInertia(float,class btVector3 &)const " (?calculateLocalInertia#btSphereShape##UBEXMAAVbtVector3###Z)
There are other people who had this or a similar problem but got no answer or it didn't work for me.
setup:
I used premake to set up the VS solution, Bullet is organized in static Libraries (as projects with source code that gets compiled to lib files) and I am now trying to link them with an application-project.
all projects are using static linking (for debug).
I've referenced all bullet projects to my project.
I've even staticly linked to the lib files from bullet (and the linker can apparently see these files, I even tried giving the absolute path)
As far as I can tell the functions exist and have the same signature in the .cpp and .h files
If you need more details let me know.
(One lead I possibly got is something about different bt_double_precision? But that might not be it and the only think I could find was floating point model using different precision. But making that the same didn't do anything)
Thanks in advance!
EDIT:
I don't think this answer applies to me
What is an undefined reference/unresolved external symbol error and how do I fix it?
EDIT:
Maybe worth mentioning: The file structure of the project is really weird (dictated by premake):
solution and project files are in: bullet3-2.89\build3\vs2010
high level header files(these are the ones used by Hello_World that include other headers): bullet3-2.89\src
source and header files are subdirectories of bullet3-2.89\src
libraries: bullet3-2.89\bin
but all headers use the correct relative paths in their include and I have set the project's include and library directories to those locations
I found a workaround. Just gonna hijack one of the example projects from Bullet and use that instead. They seem to be better at VS settings than me :D
Anyway, thanks for your suggestions.
Had the same issue where just a few of the functions didn't link.
This is most likely due to the Bullet library being built with BT_USE_DOUBLE_PRECISION, meaning all btScaler will be of type double.
But the library is included without BT_USE_DOUBLE_PRECISION, meaning the program will try to link with the float versions of the functions.
But they don't exists since the built version uses doubles.

cppcms lots of unresolved external symbols

I am having errors as follows trying to build cppcms.
Error 184 error LNK2019: unresolved external symbol __imp_pcre_compile referenced in function "public: void __cdecl booster::regex::assign(class std::basic_string,class std::allocator > const &,int)" (?assign#regex#booster##QEAAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 185 error LNK2019: unresolved external symbol __imp_pcre_exec referenced in function "public: bool __cdecl booster::regex::match(char const *,char const *,class std::vector,class std::allocator > > &,int)const " (?match#regex#booster##QEBA_NPEBD0AEAV?$vector#U?$pair#HH#std##V?$allocator#U?$pair#HH#std###2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 186 error LNK2019: unresolved external symbol __imp_pcre_fullinfo referenced in function "public: void __cdecl booster::regex::assign(class std::basic_string,class std::allocator > const &,int)" (?assign#regex#booster##QEAAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 187 error LNK2019: unresolved external symbol __imp_pcre_malloc referenced in function "public: __cdecl booster::regex::data::data(struct booster::regex::data const &)" (??0data#regex#booster##QEAA#AEBU012##Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 188 error LNK2019: unresolved external symbol __imp_pcre_free referenced in function __catch$??0data#regex#booster##QEAA#AEBU012##Z$0 C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\pcre_regex.obj
Error 189 error LNK2019: unresolved external symbol __imp_htons referenced in function "public: __cdecl booster::aio::endpoint::endpoint(class std::basic_string,class std::allocator > const &,int)" (??0endpoint#aio#booster##QEAA#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) C:\Stuff\Development\CPP\cppcms-1.0.2\build\booster\endpoint.obj
My environment is Windows 7 64 bit, using Visual Studio 2012 Professional, and CMake 2.8.9.
For everything I compile, I configure CMake to generate solutions for VS2012 to use the 64 bit compiler. When I do compile the libraries, I compile the release versions.
First I compile Zlib 1.2.7 without a problem.
Second I compile pcre-8.31 without a problem.
Then when it gets time to compile cppcms-1.0.2 I get a bunch or errors as I pointed out before. When configuring cppcms in CMake, I have my PYTHON 2.7 set, I use C:/Stuff/Development/CPP/Zlib/zlib-1.2.7/build for my ZLIB_INCLUDE_DIR, and just append a /Release/zlibstatic.lib at the end of that and you have the ZLIB library I am using, but I am not sure if I have my PCRE set up correctly.
Being that PCRE has an include and include2 in CMake, I wasn't sure what to put in them so I just did the pcre-8.31 root directory, and the pcre-8.31 build directory. For PCRE_LIB I use pcre-8.31/build/Release/pcre.lib.
I have deleted all of the build directories for the libraries and started over again even, but I still have these issues and I am not sure what could be causing them. Later I realized the booster inside of the cppcms build directory also has a solution, so I built that first, which had 3 failed projects, but most succeeded, however it didn't make a difference for cppcms building.
If you have any more questions about what I was doing, please ask and I will edit them in.
The best place to ask questions about cppcms is in the cppcms mailing list. Sign up here:
https://lists.sourceforge.net/lists/listinfo/cppcms-users
Artyom is providing an excellent support service there. Although he is also a S.O. member, not all cppcms developers are, and many of them also provide help on the mailing list. Overall, you'll get better answers there, especially since the people who are able to answer will more quickly notice your question.

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

linking error with CMake and Visual Studio 2010

I'm trying to compile osgearth library with VS2010. The library uses CMake, so after setting all dependencies it generates a VS2010 solution file. However when running build in VS I get this linker error (and 200 similar ones)
Error 7 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ofstream >::`vbase destructor'(void)" (_imp??_D?$basic_ofstream#DU?$char_traits#D#std###std##QAEXXZ) referenced in function "public: virtual void __thiscall osgEarth::DiskCache::setImage(class osgEarth::TileKey const &,struct osgEarth::CacheSpec const &,class osg::Image const *)" (?setImage#DiskCache#osgEarth##UAEXABVTileKey#2#ABUCacheSpec#2#PBVImage#osg###Z) C:\swproj\osgearth-src\src\osgEarth\Caching.obj osgEarth
I'm not very familiar with C++, is there anything else I have to set up?
You're missing a reference to std::ofstream. You either need an #include in one of your files or a reference to the standard library dll in your project.