Beruflich Dokumente
Kultur Dokumente
Home
compiling opencv in c++ Ask Question
PUBLIC Asked 8 years, 3 months ago Active 1 year, 2 months ago Viewed 60k times
Stack Overflow
i have a file with only import:
Tags The Overflow Blog
In file included from /usr/include/opencv/cxcore.hpp:46, from m.cpp:5: Question Close Updates: Phase 1
/usr/include/opencv/cxmisc.h:214: error: expected constructor, destructor, or type conversion
before ‘void’ /usr/include/opencv/cxmisc.h:220: error: expected constructor, destructor, or type
conversion before ‘int’ /usr/include/opencv/cxmisc.h:226: error: ‘CV_INLINE’ does not name a Related
type /usr/include/opencv/cxmisc.h:516: error: ‘CV_DEPTH_MAX’ was not declared in this
scope /usr/include/opencv/cxmisc.h:522: error: ‘CV_DEPTH_MAX’ was not declared in this 3245 What are the differences between a pointer
scope /usr/include/opencv/cxmisc.h:522: error: ‘CV_CN_MAX’ was not declared in this scope variable and a reference variable in C++?
In file included from m.cpp:5: /usr/include/opencv/cxcore.hpp:70: error: template declaration of 538 Why does C++ compilation take so long?
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy
‘cv::CV_EXPORTS cv::Size_’ /usr/include/opencv/cxcore.hpp:71: error: template declaration ofPolicy, and our Terms of Service.
‘cv::CV_EXPORTS cv::Point_’ /usr/include/opencv/cxcore.hpp:72: error: template declaration 1805 How can I profile C++ code running on
of ‘cv::CV_EXPORTS cv::Rect_’ /usr/include/opencv/cxcore.hpp:77: error: expected initializer Linux?
before ‘fromUtf16’ /usr/include/opencv/cxcore.hpp:78: error: expected initializer before ‘toUtf16’
4243 The Definitive C++ Book Guide and List
/usr/include/opencv/cxcore.hpp:80: error: expected initializer before ‘format’
/usr/include/opencv/cxcore.hpp:82: error: expected initializer before ‘:’ token m.cpp:38: error: 1611 What is the effect of extern “C” in C++?
expected ‘}’ at end of input
8873 What is the “-->” operator in C++?
this is my copencv lib content:
1561 Easiest way to convert int to string in C++
4 Answers Active Oldest Votes Interesting things you learned while grading?
I always forget the name of the pkg-config utility. Thanks for the simple solution! – aaronsnoswell Nov 28 '13 How is clear dialogue recorded in noisy scenes?
at 1:07
Find and replace last char '_' with '.' on filenames
Suppose I have an openCV version installed and built in a directory (the global version is different). How recursively
should I change the command you posted to compile and build my project with the new local version of Is there a bacterium that became a virus?
openCV? – Francesco Boi Aug 2 '18 at 12:46
How, and when, should I explain to potential
1 Execute pkg-config --cflags --libs opencv to see the exact parameters the global version passes to employers that I have a severe digestive disorder?
g++. Then, just copy the same flags and use your local paths instead. Simple! – karlphillip Aug 2 '18 at 21:45
Babylon 5 - Earth Alliance Presidential Powers
I installed 4.2 from source and had to do the following steps while building:
Connecting 10AWG wires to PCB
github.com/opencv/opencv/issues/13154#issuecomment-456652297 – stephen Jan 5 at 18:39
Is B♯ to F an impossible interval?
add a comment
SR-71 flew 2193 mph. How can this
mathematically be Mach 3.3?
if your development environment does not have pkg-config and because of this the accepted Question feed
answer by karlphilip is not practical, or, you need to know the minimal set of libraries required to
link your application, then assuming code such as
7
#include <cv.h>
#include <highgui.h>
int main()
{
return 0;
}
you can add library arguments from the following list sequentially from the top until you find the
minimal set of arguments that you need:
-lopencv_core
-lopencv_imgproc
-lopencv_highgui
-lopencv_ml
-lopencv_video
-lopencv_features2d
-lopencv_calib3d
-lopencv_objdetect
-lopencv_contrib
-lopencv_legacy
-lopencv_flann
For example, the C source code listed at the top of this post compiles and links cleanly with only
#include "core/core.hpp"
#include "highgui/highgui.hpp"
share improve this answer follow edited May 23 '17 at 12:10 answered Aug 16 '16 at 11:49
Community ♦ Jonathan Ben-Avraham
1 1 3,404 1 25 31
I tried compiling the g++ version from this guy's video youtube.com/watch?v=cgo0UitHfp8 on the command
line because I wanted to try it without VS. It compiles, but when I run the program nothing happens. –
luckyging3r Feb 21 '17 at 4:00
Nevermind, It's a missing windows dll file problem. Thank you for your above answer though. – luckyging3r
Feb 21 '17 at 4:20
I need to add opencv_contrib but it is not in the package list as i can see it using the command pkg-config --
libs opencv. – user8038009 Sep 24 '17 at 8:52
add a comment
I suggest you use CMake to compile OpenCV with G++ , this way is more suitable, I think.
4 cmake_minimum_required(VERSION 3.1)
project(YOUR_PROJECT_NAME)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(YOUR_EXCUTABLE YOUR_CODE_SOURCE_FILES)
target_link_libraries(YOUR_EXCUTABLE ${OpenCV_LIBS})
With this cmake file I had to change the includes to " #include "opencv2/core/core.hpp" #include
"opencv2/highgui/highgui.hpp" – jjcf89 Aug 7 '19 at 21:45
@jjcf89 great, happy to help. The use of CMake is very suitable for compiling, you should really consider
using it. For me, it helped me a lot, and it's time saving too. – Sendjasni Nov 8 '19 at 14:08
add a comment
In case if you install different version of the library please update the first line of version inside the
installation script. For more information use this tutorial. Compile it with the next line:
share improve this answer follow edited Mar 7 '19 at 16:07 answered Mar 1 '19 at 22:11
Giorgi Gvimradze
300 4 15
add a comment
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged c++ opencv image-processing
STACK OVERFLOW PRODUCTS COMPANY STACK EXCHANGE Blog Facebook Twitter LinkedIn Instagram
NETWORK
Questions Teams About
Technology
Jobs Talent Press
Life / Arts
Developer Jobs Directory Advertising Work Here
Culture / Recreation
Salary Calculator Enterprise Legal
Science
Help Privacy Policy
Other
Mobile Contact Us site design / logo © 2020 Stack Exchange Inc; user contributions
licensed under cc by-sa 4.0 with attribution required.
Disable Responsiveness rev 2020.5.7.36779