gpt4 book ai didi

c++ - 警告:std::binary_function::binary_function() 在静态库 "*.a"中具有不同的可见性(默认)

转载 作者:塔克拉玛干 更新时间:2023-11-03 08:02:11 26 4
gpt4 key购买 nike

我在静态库 .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

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

最佳答案

尝试在第一个 header 中包含而不是导入。

关于c++ - 警告:std::binary_function<int, int, bool>::binary_function() 在静态库 "*.a"中具有不同的可见性(默认),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3192779/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com