Ask Your Question

Revision history [back]

undefined reference to 'cv::aruco::Dictionary::Dictionary(cv::MAT const&, int, int)'

I have opencv 3.4 downloaded and have the opencv_contrib modules for opencv 3.4 installed. I can see that the file aruco.hpp exists. When I run g++ normally without an -I statement I get the output: fatal error: opencv2/aruco.hpp: No such file or directory compilation terminated. When I run g++ -I /opt/opencv_contrib-3.4/modules/aruco/include main.cpp -o serialize $(pkg-config opencv --cflags --libs) it overcomes this error. However, I get the following functions as not being defined. Not sure what is happening. Any help would be appreciated.

tmp/ccNd8grH.o: In function main': main.cpp:(.text+0x1a6): undefined reference tocv::aruco::Dictionary::Dictionary(cv::Mat const&, int, int)' main.cpp:(.text+0x1cd): undefined reference to cv::aruco::DetectorParameters::DetectorParameters()' main.cpp:(.text+0x357): undefined reference tocv::aruco::detectMarkers(cv::_InputArray const&, cv::Ptr<cv::aruco::dictionary> const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::Ptr<cv::aruco::detectorparameters> const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&)' main.cpp:(.text+0x43b): undefined reference to `cv::aruco::drawDetectedMarkers(cv::_InputOutputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Scalar_<double>)' collect2: error: ld returned 1 exit status