Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Linker Error compiling WinEmbed

32 views
Skip to first unread message

Florian Winkler

unread,
Apr 18, 2008, 1:59:23 PM4/18/08
to
Hi there,

I was trying to compile WinEmbed using VS 2005 on a WIN XP machine.
For that I checked out the latest mozilla head from CVS and built
XULRunner. I have a working XULRunner distro and after calling
"xulrunner --register-global" I can run also WinEmbed and it opens up
nicely and I can browse all kinds of pages.

Now the problems start when I try building WinEmbed with VS 2005.
I created a project (based on a conversion of the VS6 project that comes
with the checkout).
I am linking against the following libraries in obj-xulrunner/dist/lib
(not the SDK):
xpcomglue.lib
nspr4.lib
profdirserviceprovidersa_s.lib

furthermore I use the (i believe) correct includes, so the compiler does
not complain:
"..\..\..\obj-xulrunner\dist\include\xpcom";
"..\..\..\obj-xulrunner\dist\include\string";
"..\..\..\obj-xulrunner\dist\include\embed_base";
"..\..\..\obj-xulrunner\dist\include\webbrwsr";
"..\..\..\obj-xulrunner\dist\include\webshell";
"..\..\..\obj-xulrunner\dist\include\windowwatcher";
"..\..\..\obj-xulrunner\dist\include\profile";
"..\..\..\obj-xulrunner\dist\include\necko";
"..\..\..\obj-xulrunner\dist\include\docshell";
"..\..\..\obj-xulrunner\dist\include\dom";
"..\..\..\obj-xulrunner\dist\include\widget";
"..\..\..\obj-xulrunner\dist\include\uriloader";
"..\..\..\obj-xulrunner\dist\include\shistory";
"..\..\..\obj-xulrunner\dist\include\webbrowserpersist";
"..\..\..\obj-xulrunner\dist\include\profdirserviceprovider";
"..\..\..\obj-xulrunner\dist\include\xulapp";
"..\..\..\obj-xulrunner\dist\include\nspr";
"..\..\..\obj-xulrunner\dist\include"

And I am using the following preprocessor definitions:

XPCOM_GLUE
MOZ_DEBUG
_WINDOWS
_WIN32
_DEBUG
XP_WIN
XP_WIN32

Now, I got it almost done. The only thing that still keeps popping up
are the following linker errors:

Error 1 error LNK2019: unresolved external symbol "public: wchar_t const
* __thiscall nsAString::BeginReading(void)const "
(?BeginReading@nsAString@@QBEPB_WXZ) referenced in function "public:
wchar_t const * __thiscall nsString_external::get(void)const "
(?get@nsString_external@@QBEPB_WXZ) WebBrowserChrome.obj

...and...

Error 2 error LNK2001: unresolved external symbol "public: wchar_t const
* __thiscall nsAString::BeginReading(void)const "
(?BeginReading@nsAString@@QBEPB_WXZ) winEmbed.obj

This cost me the whole day, I have been googleing until my fingers bled,
read this newsgroup's entries until my eyes were sore, and still the
problem remains unsolved.

Does anybody have a clue, what's missing? Is it a define, or is it a
library, or are there exports missing in whatever library hosts nsAString?

Any help will be greatly appreciated. I think embedding with XULRunner
is quite elegant (at least in comparison to fiddling around with firefox
directly). And I really want to get this working.

Thanks

Florian

Benjamin Smedberg

unread,
Apr 18, 2008, 2:14:34 PM4/18/08
to
Florian Winkler wrote:

> Now the problems start when I try building WinEmbed with VS 2005.
> I created a project (based on a conversion of the VS6 project that comes
> with the checkout).

What problem are you trying to solve by using the VS project instead of the
normal mozilla makefiles?

The VC6 project is certainly out of date an not supported... I didn't even
know such a thing existed.

> I am linking against the following libraries in obj-xulrunner/dist/lib
> (not the SDK):
> xpcomglue.lib
> nspr4.lib
> profdirserviceprovidersa_s.lib

> Error 1 error LNK2019: unresolved external symbol "public: wchar_t

> const * __thiscall nsAString::BeginReading(void)const "
> (?BeginReading@nsAString@@QBEPB_WXZ) referenced in function "public:
> wchar_t const * __thiscall nsString_external::get(void)const "
> (?get@nsString_external@@QBEPB_WXZ) WebBrowserChrome.obj
>
> ...and...
>
> Error 2 error LNK2001: unresolved external symbol "public: wchar_t
> const * __thiscall nsAString::BeginReading(void)const "
> (?BeginReading@nsAString@@QBEPB_WXZ) winEmbed.obj

I would expect these symbols to be present in xpcomglue.lib. Can you run
objdump or a similar tool on xpcomglue.lib to see if they are present or not?

--BDS

Florian Winkler

unread,
Apr 19, 2008, 9:47:16 AM4/19/08
to Benjamin Smedberg
Hi Benjamin,

just wanted to let you know that I got it working finally.
It was as I had assumed: a missing compiler flag.
In order to link properly, you have to set the flag "/Zc:wchar_t-"
(Treat wchar_t as Built-In Type: NO).
Then it works. I am pretty sure this is somewhere set also in the
mozilla makefiles. But it was definitely not explicitly set in the
makefile of WinEmbed.
I will clean the MSVC8 project a little now and then submit it to you.
You can then decide whether you want to check it in to the CVS.

Florian


Benjamin Smedberg schrieb:

Florian Winkler

unread,
Apr 19, 2008, 3:30:31 PM4/19/08
to Benjamin Smedberg
Seems one cannot post attachments to the list.
I solved the problem and created a Visual Studio 2005 Project for WinEmbed.
It can be downloaded from here:
http://justdevelopment.googlepages.com/WinEmbedVS2005Project.zip

See also http://justdevelopment.blogspot.com/ for a detailed description
how to build XULRunner and set up the Visual Studio project.

Best Regards,

Florian

Florian Winkler schrieb:

0 new messages