Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a project to do but I need opencv libraries in order to do it. I did the apt-get install commands and tried to compile the c++ file that was given to me but I got a bunch of errors. I think the libraraies are not there, or they are placed in a location that the compiler doesn't seem to be looking in. where is the compiler looking for these library files and how do I set to where the compiler will include these files when it compiles a program.
I just tried to compile the program, here is what came back
Code:
/tmp/ccvvzxBm.o: In function `main':
lab1.cpp:(.text+0x5c): undefined reference to `cv::imread(std::string const&, int)'
lab1.cpp:(.text+0x1a9): undefined reference to `cv::namedWindow(std::string const&, int)'
lab1.cpp:(.text+0x1da): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
lab1.cpp:(.text+0x21a): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
lab1.cpp:(.text+0x242): undefined reference to `cv::waitKey(int)'
lab1.cpp:(.text+0x275): undefined reference to `cv::destroyWindow(std::string const&)'
/tmp/ccvvzxBm.o: In function `cv::Mat::~Mat()':
lab1.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccvvzxBm.o: In function `cv::Mat::operator=(cv::Mat const&)':
lab1.cpp:(.text._ZN2cv3MataSERKS0_[_ZN2cv3MataSERKS0_]+0x111): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/ccvvzxBm.o: In function `cv::Mat::release()':
lab1.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
I am using Backbox Linux, the most recent reccomended version.
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main( )
{
Mat img;
img = imread("tamucc.jpg", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "tamucc.jpg" and store it in 'img'
if (img.empty()) //check whether the image is loaded or not
{
cout << "Error : Image cannot be loaded..!!" << endl;
return -1;
}
double rows = img.rows; // image size
double cols = img.cols;
cout<< "The image has "<<rows<<" rows and "<<cols << " columns"<<endl;
namedWindow("MyWindow",CV_WINDOW_NORMAL);
imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window
waitKey(0); //wait infinite time for a keypress
destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"
return 0;
}
How do I reinstall it, because it's a fresh Linux distribution installation and a fresh install of opencv. I didn't do anything with anything on the system other than install the opencv development files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.