Imagemagick LNK2019 Error While Building - c++

I am trying to build a project that uses Imagemagick library. I have done the following:
Added Libraries in VC++ Directories in Tools -> Options
Added "C:\ImageMagick-6.8.6-Q16\include\Magick++";"C:\ImageMagick-6.8.6-Q16" in Project Properties -> Configuration -> C/C++ -> General -> Additional Include Libraries
Added "C:\ImageMagick-6.8.6-Q16\lib";"C:\ImageMagick-6.8.6-Q16" in Project Properties -> Configuration -> Linker -> General -> Additional Library Directories
Added CORE_RL_magick_.lib CORE_RL_Magick++_.lib CORE_RL_wand_.lib X11.lib in Project Properties -> Configuration -> Linker -> Input -> Additional Dependancies
Added C:\ImageMagick-6.8.6-Q16 in Environment Variables PATH
However, when building the project, I get several LNK2019 errors, the first is:
Error 28 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image#Magick##UAE#XZ) referenced in function "class Imagen & __cdecl lee(char *,int)" (?lee##YAAAVImagen##PADH#Z) inout.obj

Related

Linking hunspell with Visual Studio 2022

I managed to compile hunspell with Visual Studio and I'm having dificulties making it work.
Here's what I have done:
Project Properties -> C/C++ -> General -> Additional Include Directories and added this line: C:\src\hunspell\src\hunspell
Project Properties -> Linker -> General -> Additional Library Directories and added this line: C:\src\hunspell\msvc\Debug_dll\libhunspell
I got this error when I try to run:
cMain.obj : error LNK2019: unresolved external symbol _Hunspell_create referenced in function "public: __thiscall cMain::cMain(class wxString const &,int,class wxPoint const &,class wxSize const &,long)" (??0cMain##QAE#ABVwxString##HABVwxPoint##ABVwxSize##J#Z)
I also copied the C:\src\hunspell\msvc\Debug_dll\libhunspell\libhunspell.dll to my \Debug folder.
Anyone can help?
Thank you.
I solved the issue by adding the libhunspell.dll and libhunspell.lib to my Resource Files folder.

error LNK2001: unresolved external symbol "class ATL:: CTraceCategory

I got the same error as per this post below.
error LNK2001
someone replied "ATL uses ATLTRACE at debag-compilation. atlbase.h."
What does this mean? Do I have to add atlbase.h to my dependency?
You need to add atls.lib (for release configuration) or atlsd.lib ( for debug configuration) in your linker dependencies.
Right click your project -> Properties -> Linker -> Input -> Additional Dependencies
There atls.lib (for release configuration) or atlsd.lib ( for debug configuration) needs to be listed.

Linker error when trying to reference static library project in Visual Studio 2013

I have two projects in my Visual Studio solution: A (static library .lib project) and B (project that uses A). I have referenced A in B by following the steps:
right click B > properties > common properties > references > add new reference > select A from projects tab
I have set the path for .h files using additional include directories option in properties > Configuration Properties > C/C++ > General
Project A builds successfully when built separately. But on building project B, it show unresolved external symbol errors like follows:
Error 46 error LNK2001: unresolved external symbol __imp____glewActiveTexture c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\OGLDEV_Imported.lib(ogldev_texture.obj) Narovatar
Error 21 error LNK2001: unresolved external symbol __imp____glewAttachShader c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\OGLDEV_Imported.lib(technique.obj) Narovatar
Error 12 error LNK2001: unresolved external symbol __imp____glewBindBuffer c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\ogl_mesh.obj Narovatar
Error 13 error LNK2001: unresolved external symbol __imp____glewBufferData c:\Users\student\documents\visual studio 2013\Projects\MCAProject\Narovatar\Narovatar\ogl_mesh.obj Narovatar
What could I have left? Any thoughts?
Right click properties -> linker -> general ->additional library directories-> browse for your lib file directory.
Right click properties -> linker -> general ->input-> write your lib file name.
Do not forget to make them both MT or both MD like following:
properties -> C/C++ -> Code generation -> Runtime-library-> change them both to be the same
I have found my answer myself, of course with the help of help from all those who responded. Actually, the project A (.lib project) had all the header files and implementations in the same folder which I was referencing in the project B. So, when all the implementations were already available, I didn't have to link my the .dll output of project A in project B, but just had to refer it.
Another problem was that I had not linked (in project B) the libraries that were required for building project A. Now, its up and running...

Linking VS2010 with Assimp

I have been trying to get assimp working with VS2010. I have seen many questions similar to this but I just can't get it to work. Read the installation tutorials here http://assimp.sourceforge.net/lib_html/install.html and still can't get it to work.
This is what I did for VS2010 project setup:
All Configurations -> Configuration Properties -> VC++ Directories -> Library Directories ADDED
C:\assimp--3.0.1270-sdk\lib\assimp_release-dll_x64
All Configurations -> Configuration Properties -> VC++ Directories -> Include Directories ADDED
C:\assimp--3.0.1270-sdk\include
All Configurations -> Configuration Properties -> C++ -> General -> Additional Include Directories ADDED
C:\assimp--3.0.1270-sdk\include
All Configurations -> Configuration Properties -> Linker -> Input -> Additional Dependencies ADDED assimp.lib
When i write following code:
#include <assimp/Importer.hpp> // C++ importer interface
#include <assimp/scene.h> // Output data structure
#include <assimp/postprocess.h> // Post processing flags
Assimp::Importer importer;
This is the error I get:
Error 2 error LNK2019: unresolved external symbol "public: __thiscall Assimp::Importer::Importer(void)" (??0Importer#Assimp##QAE#XZ) referenced in function "void __cdecl `dynamic initializer for 'importer''(void)" (??__Eimporter##YAXXZ) C:\Users\Martin Liu\documents\visual studio 2010\Projects\MyGame\MyGame\Game.obj MyGame
Error 3 error LNK2019: unresolved external symbol "public: __thiscall Assimp::Importer::~Importer(void)" (??1Importer#Assimp##QAE#XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'importer''(void)" (??__Fimporter##YAXXZ) C:\Users\Martin Liu\documents\visual studio 2010\Projects\MyGame\MyGame\Game.obj MyGame
Any help would be appreciated
Make sure your application's bitness matches your libraries' one. E.g. you can't link against x64 libraries if your project is 32 bit.
You can check this out by right-clicking in your project and choosing "properties" and then "Configuration Manager" button.

Need help with my face recognition

I need help with my face recognition program.
I got these errors when I build my program:
error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class std::vector<float,class std::allocator<float> > const &)" (?setSVMDetector#HOGDescriptor#cv##UAEXABV?$vector#MV?$allocator#M#std###std###Z) referenced in function "int __cdecl ppledetect(void)" (?ppledetect##YAHXZ)
error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::write(class cv::FileStorage &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?write#HOGDescriptor#cv##UBEXAAVFileStorage#2#ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
error LNK1120: 11 unresolved externals
I got 11 these kinds of errors.
3 of error LNK2019 while 8 of error LNK2001 and 1 of error LNK1120.
Why is this happening?
HOGDescriptor is in opencv_objdetect.
This usually means you are missing linker dependencies (lib files)
A search shows these files you will need to add in debug:
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
If you're using Visual Studio, you can go to :
project properties -> Configuration properties -> Linker -> General
From there, set the "Additional Library Directories". This is where you enter the root directory where the lib files are located. eg: C:\program files\opencv22\lib\
You then need to go to project properties -> Configuration properties -> Linker -> Input
Under Additional Dependencies, you need to add those lib files there.
The errors mean that OpenCV is not linked correctly. Make sure you follow the instructions at http://opencv.willowgarage.com/wiki/VisualC%2B%2B.
I got same error and I resolved by previous answers.
If you're using Visual Studio: go to Project properties -> Configuration properties -> Linker -> Input -> Additional Dependencies and edit it.
You need to add "opencv_objdetect249d.lib" (I am using opencv 2.4.9 but your file name can be different, 249 can change. Look your ..\opencv\build\x64\vc10\lib directory and write your file's name: opencv_objdetect???d.lib)