CentOS6.5 Eclipse C + + version OpenCV

Source: Internet
Author: User

Recently on Linux with Eclipse (c + + version) development OpenCV, with the environment matching that really match to weeping, at a loss, fortunately with success, during reference to a lot of posts, so, special this paste, hope to give Yimeimei some small advice!

1.centos6.5 Installation

Because I made on the virtual machine, as to how you install I can only wish June good luck, here with a CentOS6.5. (Http://yunpan.cn/cfCWdjWFz8hss extract Code D3BC)

2.Eclipse (c + + version) installation

http://www.eclipse.org/downloads/

The URL is above, note is the C + + version, I also attach one here. (Http://yunpan.cn/cfCWktJ6v24ZW extract Code 098e)

Installation of the 3.c++ compiler

Baidu "CentOS Yum C + +", very simple.

4.OpenCV Installation

Baidu "CentOS OpenCV", there are a lot of installation guidance stickers, attach a sticker (http://blog.csdn.net/xuejiren/article/details/24347555) to remind you, Be sure to install a dependency package before installation (very important)!!! After the compilation, installation, configuration environment no longer repeat.

Attach a OpenCV download link again. (Http://yunpan.cn/cfC5VZqRd8nXI extract Code fa49)

5. Write a test file "Test.cpp", the compile time my problem appeared!

    

    Note the red dots in: Invoking:cross g++ Linker (linker) and g++-O "opencvtest"./MAIN.O (g++ command)

There is no problem with the program syntax, which is caused by eclipse not finding the OpenCV library file. Search a lot of posts, there is a solution is as follows:

Http://stackoverflow.com/questions/7816607/opencv-2-3-compiling-issue-undefined-refence-ubuntu-11-10

    There is a sentence in the post:g++ -o test_1 test_1.cpp `pkg-config opencv --cflags --libs`,而且 http://www.cnblogs.com/2011winseu/archive/2012/08/04/2623259.html

    也印证了这个问题!我试了下也确实可行!也就是Eclipse自动生成的g++命令缺少`pkg-config opencv --cflags --libs`这句话,那我们就手动加上去!

    也就是说在终端直接使用g++命令编译是可以的!路径也都是配置正确的!但Eclipse偏偏就没找到路径!受上面的一句话启发,我解决了这个问题,如:

Add in the place of the Red Arrows:' pkg-config opencv--cflags--libs '

    

    

Look at the g++ command in the diagram.

Complete! The whole process has a lot of details are very important, an inattentive, may miss a step and lead to the next incorrect, we also need to search for more information by the searching engine, the core of this article is the 5th, I hope that the novice can help, thank you correct!

    

CentOS6.5 Eclipse C + + version OpenCV

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.