【问题标题】:warning: std::binary_function<int, int, bool>::binary_function()has different visibility (default) in static library "*.a"警告:std::binary_function<int, int, bool>::binary_function() 在静态库“*.a”中具有不同的可见性(默认)
【发布时间】:2010-07-07 07:43:02
【问题描述】:

我在静态库 .a 中定义了一个 std::map 像这样

//////////////////////////////////////
#import <map>
class CCImage;
class ImageArray{
 std::map<int,CCImage*> mapCCImages;
private:
 int imagesLength;

public:
 ImageArray();
 ~ImageArray();
 int getImageLen();
 bool addCCImage(int key,CCImage * texture,bool replace = true);
 CCImage *getCCImage(int key);
 bool deleteCCImage(int key);
 void releaseResource();
};
/////////////////////////////////////////

我将它作为静态库编译到我的 xcode 项目中,所以将它作为“* .a”导入到项目中 但是当我使用下面的另一个定义时:

#include <map>
using namespace std;

struct UseGoodStruct{
 short GoodID;
 Byte GDirection;
};

typedef  map<int,UseGoodStruct *>  GOODSMAP;

and then when I define another variable 

GOODSMAP m_thirdLayer;

xcode 警告我如下:

ld: warning: std::binary_function<int, int, bool>::binary_function()has different visibility (default) in /Users/Vincent/Library/Application Support/QQ/FileRecv/test/libMotion-Debug.a(ImageArray.o) and (hidden) in /Users/Vincent/Library/Application Support/FileRecv/test/build/test.build/Debug-iphonesimulator/test.build/Objects-normal/i386/GeneralDataManage.o

ld: warning: std::less<int>::less()has different visibility (default) in /Users/Vincent/Library/Application Support/FileRecv/test/libMotion-Debug.a(ImageArray.o) and (hidden) in /Users/Vincent/Library/Application Support/FileRecv/test/build/test.build/Debug-iphonesimulator/test.build/Objects-normal/i386/GeneralDataManage.o

ld: warning: std::less<int>::operator()(int const&, int const&) consthas different visibility (default) in /Users/Vincent/Library/Application Support/FileRecv/test/libMotion-Debug.a(ImageArray.o) and (hidden) in /Users/Vincent/Library/Application Support/FileRecv/test/build/test.build/Debug-iphonesimulator/test.build/Objects-normal/i386/GeneralDataManage.o

我该如何解决这个问题?谢谢。

【问题讨论】:

  • GeneralDataManage.o 对象文件是否引用了第二个块代码?

标签: c++ xcode map struct visibility


【解决方案1】:

尝试在第一个标头中包含,而不是导入。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-04-02
    • 1970-01-01
    • 2014-02-09
    • 2012-10-10
    • 2020-10-19
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多