Can't Add Cv.h To Project - Stack Overflow

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs can't add cv.h to project Ask Question Asked 11 years, 9 months ago Modified 9 years, 10 months ago Viewed 21k times 3

I'm new in Xcode. And i need a help to add lib to my project. I've downloaded opencv framework. I've added it to my project. In main.h i have:

#include <stdio.h> #include <cv.h> #include <highgui.h> #import <UIKit/UIKit.h> #import "AppDelegate.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); }

}

When i run my project I got an error like this: cv.h not found, highgui.h not found. I check /usr/include via terminal and i saw that cv.h and highgui.h are located there. Tell me somebody what should i do?

Share Improve this question Follow asked Feb 16, 2013 at 18:29 user2032083's user avatar user2032083user2032083 3132 gold badges4 silver badges15 bronze badges Add a comment |

4 Answers 4

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 9

try

#include <opencv/cv.h> OR #include <opencv2/opencv.hpp>

For more information about OpenCV installation - Click Here

Share Improve this answer Follow answered Feb 16, 2013 at 18:32 Guru's user avatar GuruGuru 22k10 gold badges67 silver badges104 bronze badges 1
  • I replace stdio.h to /usr/include/opencv. And there is no error with stdio.h. Xcode see this lib perfectly clearly. – user2032083 Commented Feb 16, 2013 at 18:44
Add a comment | 3

try this:

#include <opencv/cv.h> #include <opencv/highgui.h>

if this still does not work for you try to install opencv with MacPorts. You can find module on this link: https://www.macports.org/ports.php?by=library&substr=opencv

Share Improve this answer Follow answered Jan 6, 2015 at 11:02 Matej Serbec's user avatar Matej SerbecMatej Serbec 312 bronze badges Add a comment | 1

You have to update your build settings in xcode. the error message is telling you that xcode does not know where to locate these files. There are two settings you need to update in your xcode build settings.

  1. Library Search Paths

There are a lot of settings in xcode. To reduce the number of fields you have to search through use the search box in the top right hand corner. If you type in Library you will see a section title search paths that has the setting Library Search Paths. Update that field with the location of your library headers. The most common place is /usr/local/lib.

  1. Header Search Paths

Just like step 1, you can reduce the number of options xcode displays by using the search box. Search for Header and you will see a section labeled Search Paths with the option of Header Search Paths. Update that field with the location of your library headers.

Share Improve this answer Follow edited Feb 16, 2013 at 18:47 answered Feb 16, 2013 at 18:37 Freddy's user avatar FreddyFreddy 2,2791 gold badge22 silver badges32 bronze badges 8
  • Thank you VERY much. But i have a little question also. I found "Header Search Path". When i click it i got "Debug +" and "Release +". Click "+" and i got "Any Architecture | Any SDK" and type box. Where exactly i have to include the path location? – user2032083 Commented Feb 16, 2013 at 18:57
  • via terminal I see libs in /usr/include and in /usr/local/lib i have nothing – user2032083 Commented Feb 16, 2013 at 19:02
  • It depends how you installed the library. I use brew for most of my third party libraries which puts them in /usr/local/lib & /usr/local/include. How did you install the library? – Freddy Commented Feb 17, 2013 at 0:22
  • I was following this instruction. And i have no /usr/local/lib folder. What should i do when i click "Header Search Path" i got "Debug +" and "Release +". Click "+" and i got "Any Architecture | Any SDK" and type box. Where exactly i have to include the path location? – user2032083 Commented Feb 17, 2013 at 13:13
  • I don't understand one thing. In /usr/include i have stdio.h. And It's ok, no errors. cv.h is located there too and i can't run my project – user2032083 Commented Feb 17, 2013 at 13:34
| Show 3 more comments 0

Make sure the installed location for your OpenCV headers is in your user header search path in Xcode. You can set this either in the project settings or the build settings for your target.

Share Improve this answer Follow answered Feb 16, 2013 at 18:35 iluvcapra's user avatar iluvcaprailuvcapra 9,4662 gold badges31 silver badges32 bronze badges Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.

  • The Overflow Blog
  • We'll Be In Touch - A New Podcast From Stack Overflow!
  • The app that fights for your data privacy rights
  • Featured on Meta
  • More network sites to see advertising test
  • We’re (finally!) going to the cloud!
  • Call for testers for an early access release of a Stack Overflow extension...
1 Using OpenCV in Xcode project gives linker errors 0 Cannot build OpenCV file 2 gcc compile error cv.h not found for Opencv 15 'opencv2/opencv.hpp' file not found 1 Open an OpenCv Project in XCode - Run destination My Mac 64-bit is not valid 2 cv.h: file not found opencv 3 Error when compiling cv.h: No such file or directory 0 Can't add iOS OpenCV Framework in a QT Project 1 Unable to add opencv2-2 framework to iOS project 1 Can't compile OpenCV in Xcode

Hot Network Questions

  • USB drives in space?
  • When SG-1 arrives in 1969, why is it initially an "empty" gate room?
  • What do I do with a package that is delivered to my address but the name is wrong?
  • Why aren't there any large Ultraviolet (UV) space telescopes?
  • Looking for a letter from H. P. Lovecraft to R. E. Howard
  • Why is the SPD going with Scholz instead of Pistorius?
  • Where in the Gospels does Jesus explain what 'The Truth' is?
  • How quickly could a probe reach the heliopause?
  • Naive proof that subgroup of free group is free, what's wrong?
  • Superimposed triangles
  • Lowest processable signal level after FFT with given noise level
  • Mind the gap between……
  • Chain skipping when pedaling hard
  • Moksha - Who all are eligible to get moksha
  • Was it really possible to damage my VGA card by programming it in assembly through its latches registers?
  • How were lead sheets made in the Graeco-Roman world?
  • Calculate mean/variance of sums of randomly chosen numbers from an array
  • Fixing inconsistent dashes and math glyphs in URW Palladio?
  • Does launch on warning assume incoming ICBMs carry nuclear warheads?
  • eLife-like publications and Tenure Decisions
  • What is the best language to speak with locals in Singapore?
  • Future inextendible curve
  • What is the correct article before a letter sound?
  • Can one be immortal then not immortal?
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

default

Từ khóa » Cv H