Error when trying to link to a library which references OpenCV

asked 2013-02-14 16:55:43 -0500

AlexGray gravatar image

I have a static library which uses opencv on iOS which I want to be run by an app. At the moment it is a small test library which consists of:

in FirstLibrary.h

#include<stdio.h>

using namespace std;

class MyClass
{
public:
    int Hello();
    string Hi();

};

in FirstLibrary.cpp

#include <stdio.h>
#include " FirstLibrary.h"    
int MyClass::Hello()
{
     return 231;
}

string MyClass::Hi()
{
    cv::Mat mat = cv::Mat(3,3,CV_32F);
    if(mat.rows == 3)
        return "3";
    else
        return "not 3";
}

I have included the precompiled opencv framework and added it to the library project

Yet when I attempt to link it and build I get this error :

Undefined symbols for architecture i386:
  "cv::Mat::deallocate()", referenced from:
      cv::Mat::release() in libFirstLibrary.a(FirstLibrary-ED4ABFA0F7AAAB67.o)
  "cv::Mat::create(int, int const*, int)", referenced from:
      cv::Mat::create(int, int, int) in libFirstLibrary.a(FirstLibrary-ED4ABFA0F7AAAB67.o)
  "cv::fastFree(void*)", referenced from:
      cv::Mat::~Mat() in libFirstLibrary.a(FirstLibrary-ED4ABFA0F7AAAB67.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I know this library doesn't do anything, its a test case I made to try and fix a problem I'm having with a much larger library, I'm just trying to work out where I'm going wrong.

Thanks

edit retag flag offensive close merge delete

Comments

I am also having this same issue. Can anyone shed some light?

Brett gravatar imageBrett ( 2013-04-28 20:18:34 -0500 )edit

Hello, exactly same error on a OS X project with opencv.framework that I compiled on my mac from last version sources 3.1. I'm goind to try with 2.4.13.

EDIT : if your replace 3.1 framework with 2.4.13, It works ... Depends of your needings ! Good luck!

mattoz gravatar imagemattoz ( 2016-05-27 07:58:32 -0500 )edit