LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-23-2012, 04:26 PM   #1
mangatrai
LQ Newbie
 
Registered: Jun 2012
Posts: 1

Rep: Reputation: Disabled
Error while using OpenCv


Hi!
I just installed opencv on fedora 17. I downloaded the following sample program from the official site to confirm my installation.

sample program - http://code.opencv.org/svn/opencv/tr...pp/drawing.cpp

Later when I compiled, I get the following errors along with others of similar types.
Code:
try.cpp:(.text+0xea8): undefined reference to `cv::fillPoly(cv::Mat&, cv::Point_<int> const**, int const*, int, cv::Scalar_<double> const&, int, int, cv::Point_<int>)'
try.cpp:(.text+0xec0): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
try.cpp:(.text+0xf08): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
try.cpp:(.text+0xf30): undefined reference to `cv::waitKey(int)'
All these functions have been there in the included header files. #include path given is relative to /usr/include, so it seems to be right. plus all these have there libraries too at /usr/lib/libopencv_core.so, /usr/lib/libopencv_highgui.so etc. which is again the default path where the linker will search for library. I really couldn't figure out that why g++ couldn't find the definations for these functions.

Thank you in advance!

--
Mangat Rai Modi
 
Old 06-24-2012, 08:03 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Welcome to LQ.

drawing.cpp , line 1, 2 :
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"

Please try editing to :
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>


.
 
Old 06-25-2012, 09:48 AM   #3
mangatmodi
Member
 
Registered: Aug 2009
Location: India
Distribution: Fedora 12
Posts: 35

Rep: Reputation: 0
@knudfl

Thanks for the help, however both the syntex are correct and in use. I solved the problem, it was linking error indeed. I used following command to compile my program and it worked fine
Code:
try.cpp -Wall /lib/libopencv_highgui.so /lib/libopencv_core.so
btw, how report this thread as solved?

--
Regards,
Mangat Rai Modi
 
Old 06-26-2012, 04:19 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Marking a thread as solved :

Please use the "Thread Tools" right above post #1 :
... And select : Mark as 'Solved'.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Installing OpenCV-2.3.1a on Ubuntu 11.10 OtagoHarbour Linux - Newbie 1 11-28-2011 05:38 PM
OpenCV - Pixel format of incoming image is unsupported by OpenCV golmschenk Programming 1 04-01-2011 12:32 PM
OpenCV 2.0 compile error in -current mlpa Slackware 17 01-06-2011 05:17 AM
Opencv error: /usr/bin/ld.real: cannot find -lcv; collect2: ld returned 1 exit status Ankithskarat Linux - Newbie 1 03-24-2010 12:03 AM
OpenCV fistroman Programming 0 07-28-2003 09:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration