Why I have get this kind of error in Visual Studio 2022 - symbols

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: __cdecl Window::Window(void)" (??0Window##QEAA#XZ) referenced in function "public: __cdecl AppWindow::AppWindow(void)" (??0AppWindow##QEAA#XZ) Game1 E:\Game\Game1\Game1\main.obj 1
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: __cdecl Window::~Window(void)" (??1Window##QEAA#XZ) referenced in function "public: __cdecl AppWindow::~AppWindow(void)" (??1AppWindow##QEAA#XZ) Game1 E:\Game\Game1\Game1\main.obj 1
Severity Code Description Project File Line Suppression State
Error LNK1120 2 unresolved externals Game1 E:\Game\Game1\x64\Debug\Game1.exe 1

Related

How to link luajit to c++ dll program?

This is similiar topic to this one: How to link LuaJIT with a C++ program?
I've done all the same steps he did in that topic to install luajit..
I added luajit to my project like this:
Additional Library Directiories: C:\Documents\LuaJIT-2.1.0-beta3\src
Additional Include Directiories: C:\Documents\LuaJIT-2.1.0-beta3\src
And even added this #pragma comment(lib, "lua51.lib")
and for him this worked to get rid of the linker errors. Yet still im getting these errors:
1>Clua.obj : error LNK2001: unresolved external symbol _luaopen_jit
1>Clua.obj : error LNK2001: unresolved external symbol _luaopen_ffi
1>Clua.obj : error LNK2001: unresolved external symbol _luaopen_bit
1>Clua.obj : error LNK2001: unresolved external symbol _luaJIT_setmode

error LNK2019: unresolved external symbol _ Open CV program

I am learning open CV and for the same i was trying few programs.
I am referring to this link.
http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_gender_classification.html
I am using visual studio 10 to run the same, and i think somewhere i have messed up with some configuration.
I am facing the same problem in couple of more programs (picked from same source) ,
The error which i get is as follows:-
1>main.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey#cv##YAHH#Z) referenced in function __catch$_main$0
1>main.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::subspaceReconstruct(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &)" (?subspaceReconstruct#cv##YA?AVMat#1#ABV_InputArray#1#00#Z) referenced in function __catch$_main$0
..... (more such unresolved external symbol error)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::_InputArray::empty(void)const " (?empty#_InputArray#cv##UBE_NXZ)
1>c:\users\isenses\documents\visual studio 2010\Projects\gender_classification\Debug\gender_classification.exe : fatal error LNK1120: 37 unresolved externals
1>
1>Build FAILED.
1>Time Elapsed 00:00:00.36
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My Project Properties are as follows:-
Properties->Configuration Properties ->Debugging->command arguments->C:\Users\isenses\Documents\Visual Studio 2010\Projects\gender_classification\csv.txt
Properties->Configuration Properties ->VC++ directories->Include directories->(added C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
&
C:\openCV_2.4\opencv\build\x86\vc10\lib)
C/C++->general->additional include directories (added include path of openCV ie:-
C:\openCV_2.4\opencv\build
Linker->General---
Enable incremental linking=no
Additional Library directories=C:\Program Files %28x86%29\Microsoft Visual Studio 10.0\VC\lib
C:\openCV_2.4\opencv\build\x86\vc10
linker->System---SubSystem= /SUBSYSTEM:CONSOLE
Linker->Input---
additional dependencies=
wsock32.lib
opencv_contrib2411d.lib
opencv_calib3d2411d.lib
opencv_ml2411d.lib
opencv_objdetect2411d.lib
Thank you.
Thanks to #miki i was able to build the file successfully.
The solution to my problem was:-
adding proper additional Dependencies in properties->linker->input.
Adding libraries path in windows environment variables.
I had not used proper additional dependencies as pointed by #miki and as quoted by him "well you also have to link opencv_coreXXX,opencv_highguiXXX, opencv_imgprocXXX etc... (with trailing "d" if in debug) in your Linker->Input--- additional dependencies"
Thanks again
I want to add an answer to this because I feel the documentation on the opencv site needs to be updated. I followed the tutorial and could not get the library to link. After many permutations I decided to look at the .lib files. My problem was quite simple. The lib files in the opencv tutorial are not complete. Specifically my lib directory includes three more lib files. I added three extra lib files to visual studio linker and the external symbol problem was solved.
I am unsure why this is the case because I was only trying to use functions contained within the core module. Anyway, hopefully this will help someone.
I am using opencv 3 and visual studio 2017.

error LNK2019: unsolvable external symbol (OpenCV + VS2012)

I've searched a lot but none of the answers help.
I added these things below:
include directory: D:\Program Files (x86)\opencv\build\include
library directory: D:\Program Files (x86)\opencv\build\x86\vc11\lib
additional library directory: D:\Program Files (x86)\opencv\build\x86\vc11\lib
additional dependency: %(AdditionalDependencies);opencv_core248d.lib;opencv_imgproc248d.lib;opencv_ml248d.lib;opencv_video248d.lib;opencv_features2d248d.lib;opencv_calib3d248d.lib;opencv_objdetect248d.lib;opencv_contrib248d.lib;opencv_legacy248d.lib;opencv_flann248d.lib;
I'm using 64-bit machine but adding x64 directory cause a lot of trouble, so I add x86 directory instead.
I used the test code below:
#include "opencv2/opencv.hpp"
using namespace cv;
int main()
{
Mat img = imread("../opencv.jpg");
if (img.empty())
{
fprintf(stderr, "Error: load image failed.");
return -1;
}
namedWindow("image", CV_WINDOW_AUTOSIZE);
imshow("image", img);
waitKey();
return 0;
}
And the problem is: (ignore the Chinese part)
1>test.obj : error LNK2019: unsolvable external symbol "void __cdecl cv::namedWindow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?namedWindow#cv##YAXABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: unsolvable external symbol "int __cdecl cv::waitKey(int)" (?waitKey#cv##YAHH#Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: unsolvable external symbol "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &)" (?imshow#cv##YAXABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##ABV_InputArray#1##Z),该符号在函数 _main 中被引用
1>test.obj : error LNK2019: unsolvable external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?imread#cv##YA?AVMat#1#ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z),该符号在函数 _main 中被引用
Thank you in advance!!
Please refer to the answer to this question. It's probably caused by the mixing up 64/32 bit libraries and application.
This instruction shows how to build opencv applications using VS in detail. Hope it would help.

OpenCV Errors - Accurate eye center tracking

1>C:\opencv243\build\include\constants.h(15): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>C:\opencv243\build\include\constants.h(26): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>prog.cpp(16): warning C4068: unknown pragma
1>prog.cpp(44): warning C4068: unknown pragma
1>prog.cpp(48): error C3861: 'round': identifier not found
1>prog.cpp(49): error C3861: 'round': identifier not found
1>prog.cpp(54): warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
1>prog.cpp(74): warning C4068: unknown pragma
1>prog.cpp(189): warning C4068: unknown pragma
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I want to run accurate eye center tracking programme but these are my errors... Please help me to fix this.. I havent got enough time for this project..
(if All of my code is necessary , i can send it)
*EDİT*
The last status of my project; it have build errors.. :
1>------ Build started: Project: MNOpenCV, Configuration: Debug Win32 ------
1>hkjn.obj : error LNK2019: unresolved external symbol "double __cdecl computeDynamicThreshold(class cv::Mat const &,double)" (?computeDynamicThreshold##YANABVMat#cv##N#Z) referenced in function "class cv::Point_<int> __cdecl findEyeCenter(class cv::Mat,class cv::Rect_<int>,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findEyeCenter##YA?AV?$Point_#H#cv##VMat#2#V?$Rect_#H#2#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>hkjn.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl matrixMagnitude(class cv::Mat const &,class cv::Mat const &)" (?matrixMagnitude##YA?AVMat#cv##ABV12#0#Z) referenced in function "class cv::Point_<int> __cdecl findEyeCenter(class cv::Mat,class cv::Rect_<int>,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findEyeCenter##YA?AV?$Point_#H#cv##VMat#2#V?$Rect_#H#2#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>hkjn.obj : error LNK2019: unresolved external symbol "bool __cdecl inMat(class cv::Point_<int>,int,int)" (?inMat##YA_NV?$Point_#H#cv##HH#Z) referenced in function "bool __cdecl floodShouldPushPoint(class cv::Point_<int> const &,class cv::Mat const &)" (?floodShouldPushPoint##YA_NABV?$Point_#H#cv##ABVMat#2##Z)
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\AA\Documents\Visual Studio 2010\Projects\MNOpenCV\Debug\MNOpenCV.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Maybe you forgot to add the include for the "double round (double x)" function?
#include <math.h>
If not, it might be an issue with your pragma instructions...
C++ Round Function Reference
Best regards!

How to fix error LNK2019 when using videoInput.lib with OpenCv2.1?

I am new in OpenCV and have some problems when using videoInput.lib,please help me.I am using winXP SP3+Cmake2.8.2+OpenCV 2.1+Visual Studio 2008.I have made every configuration and now OpenCv can be used when I am coding.I heard videoInput.lib has been included since OpenCV2.0 and I want to use it,so I tried codes below to quick test.
// Test2.cpp : Defines the entry point for the console application.
//
#include "videoInput.h"
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
int main(int ,char * *)
{
int width=320;
int height=240;
IplImage *pRgb=cvCreateImage(cvSize(width,height), IPL_DEPTH_8U, 3);
videoInput video;
video.setupDevice(0, width, height);
video.showSettingsWindow(0);
while(1)
{
if(video.isFrameNew(0))
{
video.getPixels(0, (unsigned char *)pRgb->imageData, false, true);
//cvFlip(pRgb,NULL,1);
char c=cvWaitKey(1);
if(c==27) break;
cvShowImage("Video", pRgb);
}
}
}
However when I build the codes,I got following error
1>------ Build started: Project: Test2, Configuration: Debug Win32 ------
1>Compiling...
1>Test2.cpp
1>c:\opencv2.1\vc2008\include\opencv\cvcompat.h(803) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>Linking...
1>Test2.obj : error LNK2019: unresolved external symbol "public: __thiscall videoInput::~videoInput(void)" (??1videoInput##QAE#XZ) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::getPixels(int,unsigned char *,bool,bool)" (?getPixels#videoInput##QAE_NHPAE_N1#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::isFrameNew(int)" (?isFrameNew#videoInput##QAE_NH#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: void __thiscall videoInput::showSettingsWindow(int)" (?showSettingsWindow#videoInput##QAEXH#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall videoInput::setupDevice(int,int,int)" (?setupDevice#videoInput##QAE_NHHH#Z) referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol "public: __thiscall videoInput::videoInput(void)" (??0videoInput##QAE#XZ) referenced in function _main
1>C:\Documents and Settings\SKSC\My Documents\Visual Studio 2008\Projects\Test2\Debug\Test2.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\SKSC\My Documents\Visual Studio 2008\Projects\Test2\Test2\Debug\BuildLog.htm"
1>Test2 - 7 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have been googling for a long time but still can not find the solution,I am gonna mad.Does anyone know how to fix these problems?
Thanks in advance.
I think you still need to link with videoInput.lib, OpenCV uses videoInput.lib but it doesn't mean you can use all functions of videoInput.lib from OpenCV
Yes, you have to explicitly link to videoInput.lib from the Linker.
Here you will find what you need.
Here is how you can solve it:
"Go to Project Properties -> Confuguration Properties -> Linker -> Input and add videoinput.lib along with the usual OpenCV library files." This is the solution from the site mentioned above. I tried it and it works.

Resources