Ask Your Question
0

Opencv 2.4.10 Visual studio 2013 / LNK2019 error

asked 2014-10-30 04:56:02 -0600

Hi! I have used opencv in python for a while now. It is really a great library.

As I want to do some shape classifications I have been following the guide http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html . One of the steps is to build the program mergevec.cpp , which can be found here. From the guide:

g++ `pkg-config --libs --cflags opencv` -I. -o mergevec mergevec.cpp\
  cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp\
  cvhaartraining.cpp\
  -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

I have been trying to compile the program in Visual studio 2013 , following the guidelines in http://www.youtube.com/watch?v=vwhTKsvHwfQ . I have added the necessary libraries and include directories to my project (see attached image C:\fakepath\dump_vs2013.png). I have managed to compile and run some of the test programs in opencv/sources/samples/cpp/ with no problems. When I build the mergevec.cpp code I get the following error.

Error   1   error LNK2019: unresolved external symbol "public: static class IOutput * __cdecl IOutput::createOutput(char const *,enum IOutput::OutputType)" (?createOutput@IOutput@@SAPEAV1@PEBDW4OutputType@1@@Z) referenced in function "public: __cdecl JpgDatasetGenerator::JpgDatasetGenerator(char const *)" (??0JpgDatasetGenerator@@QEAA@PEBD@Z)    C:\Users\daniel.dahlin\documents\visual studio 2013\Projects\ConsoleApplication_test\ConsoleApplication_test\cvhaartraining.obj ConsoleApplication_test

Googling the LNK2019 error I found that it could be because of a mismatch between cpp and header files, but I have too little knowledge of the source code of opencv to be able to tell. Does anyone have a clue what is going on here?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-12-26 10:02:23 -0600

Hi. Ioutput is an interface where their methods are declared at ioutput.h and must be implemented somewhere. I found out they were implemented at cvsamplesoutput.cpp so we just need ask gcc to compile that file. For that the correct command should be:

g++ `pkg-config --libs --cflags opencv` -I. -o mergevec mergevec.cpp\
  cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp\
  cvhaartraining.cpp cvsamplesoutput.cpp\
  -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

Unfortunately I'm not a Windows user and not sure how to do that over VS2013

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-30 04:56:02 -0600

Seen: 777 times

Last updated: Oct 30 '14