#Unsure how to install Opencv for c++
21 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
Typically on Debian-derivatives there is package which installs files required to run executables using the library and libpackage-dev that installs headers and such required to create executables using the library. See if you have a package named opencv-dev or similar.
how do I check that, if you font mind me asking
pkg-config seems to be your package manager. Surely it has a way to list packages with "opencv" in its name.
pkg-config --exists opencv-dev returns nothng in terminal
I know the cv2 library in my python environment works though
Ok, I looked up pkg-config and it is not a package manager after all.
What is your package manager? Or are you on Windows?
i use ubuntu 18.04
Then apt install libopencv-dev should install the correct stuff. Maybe afterwards pkg-config will even find it.
should apt-get or just apt?
libopencv-dev is already the newest version (3.2.0+dfsg-4ubuntu0.1).
Ok, so it's installed at least.
See if https://stackoverflow.com/a/58290585 helps.
These links seem to try to solve the issue where your pkg-config cant fnd opencv. I tried thi in my terminal ``` pkg-config --cflags --libs opencv
-I/usr/include/opencv -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_datasets -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_line_descriptor -lopencv_optflow -lopencv_video -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_rgbd -lopencv_viz -lopencv_surface_matching -lopencv_text -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core
I already have an opencv.pc file.
maybethe root of my problem is somethng esle ```c++
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
cout << "OpenCV version : " << CV_VERSION << endl;
cout << "Major version : " << CV_MAJOR_VERSION << endl;
cout << "Minor version : " << CV_MINOR_VERSION << endl;
cout << "Subminor version : " << CV_SUBMINOR_VERSION << endl;
if ( CV_MAJOR_VERSION < 3)
{
// Old OpenCV 2 code goes here.
} else
{
// New OpenCV 3 code goes here.
}
}```
When I try to compile this, I get ```/tmp/cctGf6bZ.o: In function cv::String::~String()': /usr/include/opencv2/core/cvstd.hpp:664: undefined reference to cv::String::deallocate()'
/tmp/cctGf6bZ.o: In function cv::String::operator=(cv::String const&)': /usr/include/opencv2/core/cvstd.hpp:672: undefined reference to cv::String::deallocate()'
collect2: error: ld returned 1 exit status
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.