{"id":342,"date":"2022-08-30T14:59:45","date_gmt":"2022-08-30T14:59:45","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/06\/opencv-2-4-undefined-reference-to-cvrand-collection-of-common-programming-errors\/"},"modified":"2022-08-30T14:59:45","modified_gmt":"2022-08-30T14:59:45","slug":"opencv-2-4-undefined-reference-to-cvrand-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/opencv-2-4-undefined-reference-to-cvrand-collection-of-common-programming-errors\/","title":{"rendered":"OpenCV 2.4 : undefined reference to cvRand-Collection of common programming errors"},"content":{"rendered":"<p>I can&#8217;t find the file I have to include to my code to get cvRand (and all other related functions, such as cvRandInit &#8230; ) to be recognized by the compiler. It&#8217;s weird, because in the past this code used to work as is. Must be an issue with OpenCV2.4.<\/p>\n<p>Also, when I right-clic on cvRand (I work with Qt Creator) and ask to follow the symbol under the cursor, the IDE open a file called compat.hpp. I have several files named compat.hpp, so I don&#8217;t know which one I have to include. My OS is Ubuntu 11.04.<\/p>\n<p>So far, I included core.hpp, highgui.hpp, and cv.h.<\/p>\n<p>I googled on this, but couldn&#8217;t find any related issue&#8230; so I guess this is not an issue, and I just miss something stupid.<\/p>\n<ol>\n<li>\n<p>The includes were obviously right, I figured that it has to be a lib problem, by guessing I found that I had to add libopencv_legacy.so. Everything works fine now, thx stackoverflow.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-06 03:11:31. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I can&#8217;t find the file I have to include to my code to get cvRand (and all other related functions, such as cvRandInit &#8230; ) to be recognized by the compiler. It&#8217;s weird, because in the past this code used to work as is. Must be an issue with OpenCV2.4. Also, when I right-clic on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-342","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/342\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}