Sunday, November 18, 2007

XPCOM Lab

I just stepped through the XPCOM Lab ever so carefully but still ended up with a broken XPCOM component.

My FirstXpcom.cpp file is a verbatim the one from the wiki (cut n paste action) however it still bunks out at line 26 (in the constructor) with the following error:
/home/cozby/MozillaBuild/mozilla/extensions/firstxpcom/src/FirstXpcom.cpp: In constructor ‘FirstXpcom::FirstXpcom()’:
/home/cozby/MozillaBuild/mozilla/extensions/firstxpcom/src/FirstXpcom.cpp:26: error: no matching function for call to ‘nsString_external::Assign(const char [21])’
../../../dist/include/xpcom/nsStringAPI.h:124: note: candidates are: void nsAString::Assign(const nsAString&)
../../../dist/include/xpcom/nsStringAPI.h:128: note: void nsAString::Assign(const PRUnichar*, PRUint32)
../../../dist/include/xpcom/nsStringAPI.h:132: note: void nsAString::Assign(PRUnichar)
make[2]: *** [FirstXpcom.o] Error 1
make[2]: Leaving directory `/home/cozby/MozillaBuild/build/extensions/firstxpcom/src'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/home/cozby/MozillaBuild/build/extensions/firstxpcom'
make: *** [default] Error 2

OK I lied, its slightly different from the wiki, the one on the wiki has a stray 'L' character in the constructor, so I removed that (I did try it with and without the mysterious 'L' though). The busted goods ---> http://pastebin.mozilla.org/244779

Ideas, suggestions, donations?

*UPDATE*
Thanks Dave making it 'AssignLiteral' did the trick.
I screen you screen we all screen for...

2 comments:

Unknown said...

mSomeString.AssignLiteral("boom");

joone said...

Thanks. I fixed the same problem.