有一个静态类 Pipe,在我包含的 C++ 头文件中定义。
我有兴趣调用的静态方法(来自 Objective-c)在这里:
static ERC SendUserGet(const UserId &_idUser,const GUID &_idStyle,const ZoneId &_idZone,const char *_pszMsg);
我可以访问一个似乎存储用户 ID 和 zoneID 副本的 Objective-c 数据结构——它看起来像:
@interface DataBlock : NSObject
{
GUID userID;
GUID zoneID;
}
查找了 GUID def,它是一个结构,其中包含一堆用于相等的重载运算符。第一个函数签名中的 UserId 和 ZoneId 是 #typedef GUID
现在,当我尝试调用该方法时,无论我如何转换它(const UserId)、(UserId)等,我都会收到以下链接器错误:
Ld build/Debug/Seeker.app/Contents/MacOS/Seeker normal i386
cd /Users/josh/Development/project/Mac/Seeker
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/Users/josh/Development/TS/Mac/Seeker/build/Debug -L/Users/josh/Development/TS/Mac/Seeker/../../../debug -L/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1 -F/Users/josh/Development/TS/Mac/Seeker/build/Debug -filelist /Users/josh/Development/TS/Mac/Seeker/build/Seeker.build/Debug/Seeker.build/Objects-normal/i386/Seeker.LinkFileList -mmacosx-version-min=10.5 -framework Cocoa -framework WebKit -lSAPI -lSPL -o /Users/josh/Development/TS/Mac/Seeker/build/Debug/Seeker.app/Contents/MacOS/Seeker
Undefined symbols:
"SocPipe::SendUserGet(_GUID const&, _GUID const&, _GUID const&, char const*)", referenced from:
-[PeoplePaneController clickGet:] in PeoplePaneController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
这是类型/函数签名错误,还是真正的某种链接器错误?我有定义所有这些类型和静态类的标题#imported - 我也尝试了#include,以防万一,因为我已经绊倒了:P
原谅我,我来自网络技术背景,所以这种 c 风格的内存管理和不变性的东西是超级模糊的。
编辑:添加了完整的链接器错误文本。将“功能”更改为“方法”。另外我会注意到,我们正在使用一个自定义的 makefile 来编译这个之外的一些项目。不过,在这个 xcode 项目中,SocPipe 静态方法在其他地方被引用,并且似乎编译得很好。