【问题标题】:warning: XXXX has different visibility (default) in YYYY and (hidden) in ZZZZ警告:XXXX 在 YYYY 中具有不同的可见性(默认)和在 ZZZZ 中(隐藏)
【发布时间】:2010-12-04 09:45:49
【问题描述】:

我正在尝试制作一个使用 OpenCV 和另一个 C++ 库的 iPhone 应用程序。 它似乎可以编译和链接。它确实有效。 只是我想摆脱这个丑陋的警告:

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

这是什么意思?,我该如何解决?

以防万一,这是组合类的头文件,来自我提到的库。

//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;
};

提前致谢

伊格纳西奥

【问题讨论】:

  • 我很确定这是个骗子。

标签: iphone c++ opencv


【解决方案1】:

似乎libcxcore.a 和combination.o 编译时使用了不同的符号可见性选项。

阅读符号可见性there。

所以,我猜你只需要编译 combination.cpp 和 -fvisibility=default 标志。如果您使用 XCode,请检查“GCC - 代码生成”部分中的“默认隐藏符号”设置。两个项目都应该取消选中它。

【讨论】:

  • 我已经尝试过#pragma GCC visibility push(default) class Combination 并且警告没有消失。我还检查了 Xcode 并且未选中“默认隐藏的符号”。我还有什么其他选择? (+1 链接;))
  • 等等!。我刚刚尝试检查、编译和取消选中默认隐藏的符号,警告消失了!非常感谢;)
  • 当我在我的应用程序中使用 funambol sdk 时,它也对我有用。
  • 还必须选中然后取消选中“默认隐藏符号”以消除警告...由于某种原因,目标和项目设置不匹配,而没有报告设置修改在目标级别:/
猜你喜欢
  • 1970-01-01
  • 2015-01-11
  • 2017-12-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-15
  • 2017-07-04
  • 1970-01-01
相关资源
最近更新 更多