Ask Your Question
0

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

asked 2020-01-13 15:19:22 -0500

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-01-14 02:39:06 -0500

berak gravatar image

updated 2020-01-14 03:02:04 -0500

When I run g++ -I /opt/opencv_contrib-3.4/modules/aruco/include main.cpp

you have to properly build and install opencv + opencv_contrib libraries first.

don't include headers from the src tree, but from where you installed it to (by default: /usr/local/include)

then you have to link required opencv libraries, e.g.:

g++ -lopencv_aruco -lopencv_core ...(more libs)...  main.cpp
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-01-13 15:19:22 -0500

Seen: 31 times

Last updated: Jan 14