Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: XXXX has different visibility (default) in YYYY and (hidden) in ZZZZ

Tags:

c++

opencv

iphone

I am trying to make an iPhone app that uses OpenCV plus another C++ Library. It seems to compile and link fine. It actually works. Is just I want to get rid of this ugly warning:

ld: warning: std::vector<int, std::allocator<int> >::_M_insert_aux(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, int const&)has different visibility (default) in /Users/nacho4d/Documents/Projects/iOS/iAR/opencv_device/lib/libcxcore.a(cxdatastructs.o) and (hidden) in /Users/nacho4d/Documents/Projects/iOS/iAR/build/iAR.build/Debug-iphoneos/iAR.build/Objects-normal/armv6/combination.o

What does it mean?, How can I solve it?

just in case, this is the header of combination class, from the library I mentioned.

//combination.h
typedef std::vector<int> combi;
typedef std::vector< combi > allcombi;
class Combination
{
public:
    void Init(const int n, const int m);
    allcombi::iterator begin();
    allcombi::iterator end();
    allcombi::const_iterator begin() const;
    allcombi::const_iterator end() const;
private:
    void Nest(int nest, int column, int n1, int n2, int k[], allcombi &result);
private:
    allcombi m_data;
};

Thanks in advance

Ignacio

like image 283
nacho4d Avatar asked Dec 04 '10 09:12

nacho4d


1 Answers

It seems libcxcore.a and combination.o are compiled with different symbol visibility options.

Read about symbol visibility there.

So, I guess you just need to compile combination.cpp with -fvisibility=default flag. If you use XCode, check "Symbols Hidden by Default" setting in "GCC - Code Generation" section. It should be unchecked for both projects.

alt text

like image 186
Stas Avatar answered Oct 21 '22 09:10

Stas