Ask Your Question
0

C++ Error about "Expected primary-expression before ‘>’ token"

asked 2018-03-07 07:53:36 -0600

Antik gravatar image

updated 2018-03-07 08:11:40 -0600

berak gravatar image

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

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 a C++ code. If anyone need further more information then please do let me know. Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2018-03-07 08:17:48 -0600

berak gravatar image

it 's either:

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

or:

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

the linker error is unrelated, you forgot to add some file with the code for lbp::OLBP(cv::Mat const&, cv::Mat&) to your makefile or project

edit flag offensive delete link more

Comments

@berak I've used your both codes but the error is same.

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

So I think maybe it's a linker problem. Can you give me one example of which kind of files missing in my makefile or project.

Antik gravatar imageAntik ( 2018-03-08 04:10:29 -0600 )edit

again, it's unrelated to your previous error. and yes, a linker problem

lbp::OLBP -- that's not from opencv libs. there may be some .cpp file containing that function. make sure, you compile and link it along with your other code

berak gravatar imageberak ( 2018-03-08 04:43:50 -0600 )edit

@berak Thanks. So the code : `lbp::OLBP(cv::Mat const&, cv::Mat&)' Is this a user defined function?

Antik gravatar imageAntik ( 2018-03-11 09:16:19 -0600 )edit

looks like.

berak gravatar imageberak ( 2018-03-11 10:39:09 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-03-07 07:53:36 -0600

Seen: 5,289 times

Last updated: Mar 07 '18