You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Scott Anderson <sa...@bonddesk.com> on 2002/09/11 16:48:11 UTC
Problem with cout disappearing when linking libxerces-c into executable
Hi all,
I've recompiled xerces 2.1 using gcc 2.95.2 + STL patches on Solaris
2.7. However, any time I link the xerces library into an executable,
cout no longer works.
Example:
#include <iostream>
using namespace std;
int main(int argC, char* argV[])
{
cout << "Testing cout. Apparently, it works.\n" << endl << flush;
return 0;
}
The above program works fine without libxerces-c linked in. As soon as
the library is linked, nothing is output any longer. Note that
cout.good() is true as well when cout is not working. cin and cerr do
not appear to work either. Also note that we have renamed the library to
follow local conventions (no dashes).
The one change I had to make to the source code to get it to compile was
changing '<iostreams.h>' to '<iostreams> using namespace std;' in
framework/StdOutFormatTarget.cpp.
My compile options:
PLATFORM_COMPILE_OPTIONS = -fPIC -instances=static -fhonor-std
-D${PLATFORM} -D_REENTRANT
My linker options:
MAKE_SHARED = ${CXX} -D${PLATFORM} ${LDFLAGS} -fPIC
-Wl,'-dy,-G,-zignore'
MAKE_SHARED_C = ${CC} -D${PLATFORM} ${LDFLAGS} -fPIC
-Wl,'-dy,-G,-zignore'
Note that the -shared has been replaced with -dy, and the -zignore is
necessary to stop the relocatable errors.
nm shows that cout is undefined in libxerces-c, and defined in the
executable (which is as it should be AFAIK).
I also had to use gcc instead of g++ in order to suppress the automatic
inclusion of libstdc++; otherwise I got relocatable errors upon linking
the .so.
Any ideas? Any other information I can provide? I'm not much of a C++
programmer, so please bear with me a bit.
Regards,
-scott anderson
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org