what might cause problems with openCV linking?
I followed some instructions for installing openCV3, the same ones I usually follow, and it would seem openCV3 is installed. but every program I write returns errors on compiling. The same programs work fine everywhere else i run them. this would be:
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j 4
sudo make install
sudo ldconfig
I am on linux, and my compile/ build flags are:
g++ -Wall -g `pkg-config --cflags --libs opencv` -o file file.cpp
I have tried purging, uninstalling, deleting old opencv versions, with reboots, but after installing, and yes, I have run sudo ldconfig when I try to compile, I get this:
g++ Wall -g `pkg-config --cflags --libs opencv` -o test test.cpp
/tmp/cchudewP.o: In function `main':
/home/jay/Desktop/test.cpp:7: undefined reference to `cv::imread(cv::String const&, int)'
/home/jay/Desktop/test.cpp:11: undefined reference to `cv::namedWindow(cv::String const&, int)'
/home/jay/Desktop/test.cpp:12: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
/home/jay/Desktop/test.cpp:13: undefined reference to `cv::waitKey(int)'
/home/jay/Desktop/test.cpp:14: undefined reference to `cv::destroyWindow(cv::String const&)'
/tmp/cchudewP.o: In function `cv::String::String(char const*)':
/usr/local/include/opencv2/core/cvstd.hpp:622: undefined reference to `cv::String::allocate(unsigned long)'
/tmp/cchudewP.o: In function `cv::String::~String()':
/usr/local/include/opencv2/core/cvstd.hpp:664: undefined reference to `cv::String::deallocate()'
/tmp/cchudewP.o: In function `cv::String::operator=(cv::String const&)':
/usr/local/include/opencv2/core/cvstd.hpp:672: undefined reference to `cv::String::deallocate()'
/tmp/cchudewP.o: In function `cv::Mat::~Mat()':
/usr/local/include/opencv2/core/mat.inl.hpp:592: undefined reference to `cv::fastFree(void*)'
/tmp/cchudewP.o: In function `cv::Mat::release()':
/usr/local/include/opencv2/core/mat.inl.hpp:704: undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
basically, every call to anything openCV fails.
I have looked for the opencv libraries, and they are in the appropriate place:
ls -al /usr/local/include/opencv2/*.hpp
-rw-r--r-- 1 root root 27236 Jan 26 20:12 /usr/local/include/opencv2/aruco.hpp
-rw-r--r-- 1 root root 7518 Jan 26 20:12 /usr/local/include/opencv2/bgsegm.hpp
...
They are there.
I have tried all the things I know how to do, and I get the same issue every-time. I am on Ubuntu, if anyone can help me get oopencv installed so I can compile programs, I would be grateful.