Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:02:50+00:00 2026-06-03T07:02:50+00:00

g++ cv.cpp -o cv -I /usr/local/include/opencv -L /usr/local/lib -lm -lcv -lhighgui -lcvaux Error: /usr/bin/ld:

  • 0
g++ cv.cpp -o cv -I /usr/local/include/opencv
    -L /usr/local/lib  -lm -lcv -lhighgui -lcvaux

Error:

/usr/bin/ld: cannot find -lcv
collect2: ld returned 1 exit status

Code:

#include <cv.h>
#include <ml.h>
#include <cxcore.h>
//#include <cxtypes.h>
#include <highgui.h>

int main(int argc, char* argv[])
{
    IplImage* img = cvLoadImage( "bal.png" );
    cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
    cvShowImage("Example1", img);
    cvWaitKey(0);
    cvReleaseImage( &img );
    cvDestroyWindow( "Example1" );
    return 0;
}

It’s 32 bit,

locate libcv
/usr/lib/libcv.so.2.1
/usr/lib/libcv.so.2.1.0

`pkg-config --cflags --libs opencv`

-I/usr/local/include/opencv
-I/usr/local/include  /usr/local/lib/libopencv_calib3d.so
/usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so
/usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so
/usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so
/usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so
/usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so
/usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so
/usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so
/usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so

Installed OpenCV-2.4.0 in /usr/local, I also have a system python-opencv.
Where am i doing the mistake? What should i do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:02:51+00:00Added an answer on June 3, 2026 at 7:02 am

    As seen from the changelog published on the OpenCV site (for version 2.2), the library names have changed from version 2.2 onwards, so the library names used to link for version 2.1 cannot be used to compile with version 2.4 (i.e. libcv.so which is linked through -lcv is not valid library name for version > 2.1 as so on ). You need to pass the libraries which are part of the new version of OpenCV (which have been listed through pkg-config command). You can make use of pkg-config to pass the compiler & linker flags something on these lines : g++ cv.cpp -o cv $(pkg-config --cflags --libs opencv).
    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I installed opencv from Macports and it is in /opt/local/include I tried to compile
This error is inexplicably occurring. Here is the code and output: timer.cpp: #include timer.h
It's OpenCV-2.4.0 cd opencv mkdir release cd release cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D
I have the following CPP code snippet and the associated error message: Code snippet
// Huffman Tree.cpp #include stdafx.h #include <iostream> #include <string>//Necessary to do any string comparisons
What am I doing wrong here? // file main.cpp #include <iostream> #include <boost/numeric/ublas/vector.hpp> #include
Compiling the following: // file main.cpp #include <string> #include <boost/lexical_cast.hpp> int main() { boost::lexical_cast<std::string>(
I'm new to write cpp in vim and I find the vim plugin is
// File test.cpp #include <my_global.h> #include <algorithm> int main() { return 0; } Compiled
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf /usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/cppapplication_1 mkdir -p build/Debug/GNU-MacOSX rm -f

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.