警告:std :: binary_function <int,int,=“”bool =“”> :: binary_function()在静态库“* .a”中具有不同的可见性(默认值)</int,>

时间:2010-07-07 07:43:03

标签: c++ xcode map struct visibility

我在静态库中定义了一个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

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

1 个答案:

答案 0 :(得分:0)

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