目的: 调用RogueWave 的RWWString::hash 方法。
源码:
#include <iostream.h>
#include <rw/tools/wstring.h>
#include <string>
const int GUI_INSTANCE_LEN= 11;
void OSS(string input)
{
RWWString instance(input.c_str(),RWWString::ascii);
unsigned hashValue = instance.hash();
char buf[GUI_INSTANCE_LEN];
snprintf(buf,GUI_INSTANCE_LEN,(char*)"%X",hashValue);
cout<<"rw string :"<<buf<<endl;
}
int main()
{
string input;
cout<<"begin"<<endl;
while(cin>>input)
{
cout<<"you entere:"<<input<<endl<<endl;
cout<<"*****************************"<<endl;
cout<<"use Rogue Wave library:"<<endl;
OSS(input);
}
cout<<"exit";
}
编译选项:
aCC -o xyz -v -D_RWCONFIG=12d -DRW_THR_OS_VERSION_HPUX=0x1111 -I/opt/nokiaoss/pf3party_c/pf3rwt -lnsl -L/opt/nokiaoss/pf3party_c/pf3rwt/lib -lstreams1312d -ltls7712d
-ltrace2312d -lfactory1312d -lfunctor2312d -lfunctor_list2312d -lfunctor_map2312d -litc2312d -lpointer2312d -lserial1312d -lsync2312d -lthread2312d -lthrexcept2312d -ltypes1312d -AA test.C
遇到的问题:
(1) Include file <iosfwd> not found
缺少 -AA 参数
(2) -D_RWCONFIG
(3)
/usr/ccs/bin/ld: Unsatisfied symbols
RWWString::initChars(const char *,unsigned long) (first referenced in test.o) (code)
RWWString::hash(RWWString::caseCompare) const (first referenced in test.o) (code)
缺少-ltls7712d