Hi, I too am trying to build a firefox extension using msvc on
WindowsXP.

I am sure you already tried setting the build type to "Multi-Threaded
DLL" for your component build right?

If not, you might be seeing link-errors like this.

Cheers :-)


On Nov 20, 1:51 pm, [EMAIL PROTECTED] wrote:
> Hello folks.  Here is where I'm at.  Any help would be a lifesaver.
>
> My goal: modify the mozilla scriptable plugin example to make
> notifications to the nsIObserverService. My javascript will receive
> notifications as an observer. I want to create events in my plugin and
> have my javascript see them.
>
> I'm trying to follow the advice offered 
> here:http://groups-beta.google.com/group/mozilla.dev.tech.xpcom/browse_thr...
>
> Anyway, as soon as I try adding a line to use this nsCOMPtr line:
>     nsCOMPtr<nsIObserverService> observerService;
>     //observerService =
> do_GetService("@mozilla.org/observer-service;1");
>     //observerService->NotifyObservers (context, topic, wstring);
>
> I get linker errors:
>
> Error   1       error LNK2019: unresolved external symbol "public: __thiscall
> nsCOMPtr_base::~nsCOMPtr_base(void)" (??1nsCOMPtr_base@@[EMAIL PROTECTED])
> referenced in function "public: __thiscall nsCOMPtr<class
> nsIObserverService>::~nsCOMPtr<class nsIObserverService>(void)"
> ([EMAIL PROTECTED]@@@@[EMAIL PROTECTED])   plugin.obj
>
> Soo as reccomended on various xpcom sites,   I link the following 2
> libraries:
> xpcom.lib and xpcomglue_s.lib
>
> This is where I get into linker hell. The first errors I'm presented
> with are:
>
> Error   1       error LNK2005: "private: __thiscall type_info::type_info(class
> type_info const &)" (??0type_info@@[EMAIL PROTECTED]@@Z) already defined in
> LIBCMTD.lib(typinfo.obj)        MSVCRT.lib
>
> and
>
> Error   2       error LNK2005: "private: class type_info & __thiscall
> type_info::operator=(class type_info const &)"
> (??4type_info@@[EMAIL PROTECTED]@@Z) already defined in
> LIBCMTD.lib(typinfo.obj)        MSVCRT.lib
>
> scouring the web for this, I've come across various suggestions that
> don't relate exactly to what I'm trying to do but are similar:
>
> 1.) Use /NODEFAULTLIB.     90 compile errors from just about every
> library I'm using.
> 2.) Ignore Specific Library:    over 600 errors if I ignore libcmtd.
> 3.) Compile as a /MDd Multi-threaded Debug DLL:     sure it compiles,
> but the plugin just plain doesnt work.
> 4.) Some option like /FORCE Multiple or some such.   Same as above.
> compiles but doesn't function.
>
> I've scoured the XPCOM glue page, and answers to this don't jump out at
> me. I've only been working with VS2005 and C++ for about 3 weeks now.
>
> So my questions are:
>
> 1.) How can I use the glue, in order to use nsCOMPtr, without getting
> all these linker errors. Some sites mentioned its possible that the
> glue libraries were not built with /MTd, and therefore are not working
> with my project. If thats the case, how does a c++ newb go about
> resolving mixed CRT's?
>
> 2.) Is there another method to use nsIObserver, or a completely
> different method that will let me communicate back to javascript?
>
> 3.) How gray will my hair get before this is figured out?
>
> Any help would be greatly appreciated! If you are in the DC area you
> will get beer for life.
>
> -Rob
>
> 1.) I'm using a modified version of the mozilla scriptable plugin
> example.
> 2.) I've downloaded 1.8 of the sdk.

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to