andrewssobral / bgslibrary

A C++ Background Subtraction Library with wrappers for Python, MATLAB, Java and GUI on QT
MIT License
2.2k stars 740 forks source link

error: LNK2019 #83

Open mv2050arshad opened 7 years ago

mv2050arshad commented 7 years ago

i build my your program QT_GUI on 64x compiler 14 and opencv 3.3.0 and qt creator 4.3.1 64bit and your new update source (bgslibrary-bgslib_py27_ocv3_win64), but i have error below

mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl bgslibrary::algorithms::CodeBook::CodeBook(void)" (??0CodeBook@algorithms@bgslibrary@@QEAA@XZ) referenced in function "class bgslibrary::algorithms::IBGS * __cdecl bgslibrary::createInstance<class bgslibrary::algorithms::CodeBook>(void)" (??$createInstance@VCodeBook@algorithms@bgslibrary@@@bgslibrary@@YAPEAVIBGS@algorithms@0@XZ) debug\bgslibrary_gui.exe:-1: error: LNK1120: 1 unresolved externals

bbernhard commented 7 years ago

Had the same error. Change the following to fix it:

diff --git a/gui_qt/bgslibrary_gui.pro b/gui_qt/bgslibrary_gui.pro
index feedbf6..66a6d28 100644
--- a/gui_qt/bgslibrary_gui.pro
+++ b/gui_qt/bgslibrary_gui.pro
@@ -124,7 +124,8 @@ SOURCES += bgslibrary_gui.cpp\
     ../package_bgs/VuMeter.cpp \
     ../package_bgs/WeightedMovingMean.cpp \
     ../package_bgs/WeightedMovingVariance.cpp \
-    ../package_bgs/_template_/amber/amber.c
+    ../package_bgs/_template_/amber/amber.c \
+    ../package_bgs/CodeBook.cpp

 HEADERS  += mainwindow.h \
     qt_utils.h \
@@ -236,7 +237,8 @@ HEADERS  += mainwindow.h \
     ../package_bgs/ViBe.h \
     ../package_bgs/VuMeter.h \
     ../package_bgs/WeightedMovingMean.h \
-    ../package_bgs/WeightedMovingVariance.h
+    ../package_bgs/WeightedMovingVariance.h \
+    ../package_bgs/CodeBook.h \

 FORMS    += mainwindow.ui
sallenkey-wei commented 6 years ago

Add the ./bgslibrary-master/package_bgs/CodeBook.cpp to the project source files, the file called CodeBook.cpp was ignored.