1

I'm trying to load a xml file using a SVM object.

While running this following code:

svmNew = SVM::load<SVM>("Liveness_classifier.xml");

It's showing the following error:

error: expected primary-expression before ‘>’ token

If I change the code like this:

svmNew = SVM::load("Liveness_classifier.xml");

Then it's showing the following error:

(.text+0xa7f): undefined reference to `lbp::OLBP(cv::Mat const&, cv::Mat&)'
collect2: error: ld returned 1 exit status

Does anyone have any solution for this kind of error?

I'm using Ubuntu 16.4 and OpenCV3.4, and this is C++ code.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
  • 4
    Have you consulted the documentation on how to use SVM? What did it say? – Lightness Races in Orbit Mar 07 '18 at 13:46
  • 1
    Possible duplicate for the first error: https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords – NathanOliver Mar 07 '18 at 13:48
  • For your first error, you probably need `SVM::SVM` in between `<` and `>`. Your second error looks like a linker error which means you probably need `-l` and/or `-L` flags when you compile. – Turix Mar 07 '18 at 13:49
  • @LightnessRacesinOrbit Yes I've followed the documentation of SVM but still it didn't work. – Antik Rezwan Hasan Mar 08 '18 at 09:58
  • @NathanOliver Yes the error is duplicate but here the scenario is different and that's not working. – Antik Rezwan Hasan Mar 08 '18 at 09:58
  • @Turix I have changed the code like this: svmNew = SVM::load("Liveness_classifier.xml"); But still it's not working. I think this one maybe ok: svmNew = SVM::load("Liveness_classifier.xml"); But can you give me one example of using -l and/or -L flags when compiling. – Antik Rezwan Hasan Mar 08 '18 at 10:03
  • They're two completely different lines of code. Which one did the documentation say to use? – Lightness Races in Orbit Mar 08 '18 at 10:47
  • @LightnessRacesinOrbit The documentation says: svmNew = SVM::load("Liveness_classifier.xml"); this one – Antik Rezwan Hasan Mar 10 '18 at 13:57
  • @Turix I'm using this line to compile: g++ -std=c++11 demo.cpp `pkg-config --libs --cflags opencv` -o demo If I want to use the -L flags then how can I use this? Can you please give me an example? – Antik Rezwan Hasan Mar 13 '18 at 17:36

0 Answers0