C++ 与nsRunnable链接时对typeinfo的未定义引用

C++ 与nsRunnable链接时对typeinfo的未定义引用,c++,gecko,C++,Gecko,由于firefox 12 sdk删除了“代理”对象,我想使用nsRunnable。我基本上复制并粘贴了代码: class NotifyTask : public nsRunnable { public: NotifyTask(nsISupports *subject, const char *topic, bool remref) : mWorkerThread(do_GetCurrentThread()) { MOZ_ASSERT(!NS_IsMainThread())

由于firefox 12 sdk删除了“代理”对象,我想使用nsRunnable。我基本上复制并粘贴了代码:

class NotifyTask : public nsRunnable
{
public:
  NotifyTask(nsISupports *subject, const char *topic, bool remref)
    : mWorkerThread(do_GetCurrentThread())
  {
    MOZ_ASSERT(!NS_IsMainThread()); // This should be running on the worker thread
  }

  NS_IMETHOD Run() {
    MOZ_ASSERT(NS_IsMainThread()); // This method is supposed to run on the main thread!

    mWorkerThread->Shutdown();
    return NS_OK;
  }

private:
  nsCOMPtr<nsIThread> mWorkerThread;
};
class NotifyTask:公共nsRunnable
{
公众:
NotifyTask(支持*主题、常量字符*主题、bool remref)
:mWorkerThread(do_GetCurrentThread())
{
MOZ_ASSERT(!NS_IsMainThread());//这应该在工作线程上运行
}
n_i方法运行(){
MOZ_ASSERT(NS_IsMainThread());//这个方法应该在主线程上运行!
mWorkerThread->Shutdown();
返回NS_OK;
}
私人:
nsCOMPtr mWorkerThread;
};
我试着编译它。我有以下错误:

g++ -std=gnu++0x -Wall -O2 -c  -DUSE_LIBUSB -fPIC -DHAVE_CRYPTO -fpermissive -DCRYPTPP -fshort-wchar -I../../xulrunner-sdk/include -o gipsy.o gipsy.cpp
gipsy.cpp:74:7: warning: ‘NotifyTask’ declared with greater visibility than the type of its field ‘NotifyTask::<anonymous>’ [-Wattributes]
gipsy.cpp:74:7: warning: ‘NotifyTask’ declared with greater visibility than its base ‘nsRunnable’ [-Wattributes]
g++ -std=gnu++0x -Wl,-z,defs -Wall -Os -o gipsy.so -shared gipsy.o gipsymodule.o tracklog.o gpslib/data.o gpslib/garmin.o gpslib/gps.o gpslib/phys.o gpslib/igc.o gpslib/aircotec.o cp1250.o prefparser.o gpslib/foreignigc.o gpslib/mlr.o gpslib/flymaster.o gpslib/compeo.o gpslib/iq.o ../libs/libcryptopp.a -lusb -L../../xulrunner-sdk/lib -lxpcomglue_s -lxul -lxpcom -lplds4 -lplc4 -lnspr4 -lpthread -ldl -lmozalloc
gipsy.o:(.data.rel.ro._ZTI10NotifyTask[typeinfo for NotifyTask]+0x10): undefined reference to `typeinfo for nsRunnable'
collect2: ld returned 1 exit status
g++-std=gnu++0x-Wall-O2-c-DUSE_LIBUSB-fPIC-DHAVE_CRYPTO-fppermissive-DCRYPTPP-fshort wchar-I.././xulrunner sdk/include-o gipsy.o gipsy.cpp

gipsy.cpp:74:7:警告:“NotifyTask”声明的可见性比其字段“NotifyTask::的类型更高,这可能是gecko sdk是使用-fvisibility=hidden和其他.so”中某些奇怪的“键方法”构建的。这是Gecko sdk中的错误还是我做错了什么?

Gecko sdk没有与RTTI链接-向特定的.o文件添加“-fno RTTI”参数修复了问题。

Gecko sdk没有与RTTI链接-向特定的.o文件添加“-fno RTTI”参数修复了问题