Eric wrote:

(I apologize in advance if this post isn't related closely enough to
the topic of this group.)


I've been trying to modify some code that involves nsString variables. I'm having trouble just compiling the code.

I've chopped the C++ code down to just:

-----------------------------------------------------
#include "nspr.h"
#include "nsString.h"

main() {
 nsString aVendorName;
}
-----------------------------------------------------


and I'm trying to compile it with:


-----------------------------------------------------
g++ \
-L/opt/SUNWics5/cal/bin \
-licsexp10 -lcsapi_xpcom10 -lmailwave -lmee -lcyrus \
-lyasr -lasync -lchartable \
-lnsres31 -lnsfmt31 -lnsuni31 -lnscnv31 -lnsbrk31 -lnscol31 \
-ladminutil -ldb26 -lldap40 -lnspr3 -lplds3 -lplc3 \
-I/opt/SUNWics5/cal/csapi/include \
-I/opt/SUNWics5/cal/csapi/include/include \
-R/opt/SUNWics5/cal/bin:/usr/local/lib \
-g t.cpp \
-Wno-deprecated
-----------------------------------------------------

which returns:

-----------------------------------------------------
Undefined                       first referenced
symbol                             in file
nsString::nsString[in-charge]()     /var/tmp//ccsNzmyv.o
nsString::~nsString [in-charge]()   /var/tmp//ccsNzmyv.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
-----------------------------------------------------

 Does anyone happen to know what I'm doing wrong or how I'd debug
this?

Thank you.

Eric
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom



It looks like you need to link to the implementation of nsString. You can solve this problem in a number of ways. One simple solution is to link against libxpcom.so since it will contain the missing symbols. However, this will tie your application to that specific version of libxpcom.so since there is no guarantee that future versions of libxpcom.so will export the same symbols.


If you want a solution that works with future versions of Mozilla, then I suggest using nsEmbedString in place of nsString.

-Darin
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to