Well, I was curious as to why
tmp.o: In function `main’:
tmp.o(.text+0x2a): undefined reference to
`runtime_error::runtime_error(basic_st
ring<char, string_char_traits,
__default_alloc_template<false, 0> > const
&)’
was missing, but there was a version in the lib with
__default_alloc_template<true, 0>
so some grepping through the headers etc etc later, I found it.
Jeff Strickrott wrote:
Thanks Colin:
Yes worked like a charm. Now to the important information, what lead you
to poke around inside the stl_config.h file and associate _PTHREADS with
my problem?
Regards,
TIA
–Jeff Strickrott
P.S. Have you attempted to install any of the newer versions of gcc on
QNX 6.2.0NC or 6.2.1 NC and had it play well with the remaining qnx
libraries?
I’m afraid I haven’t used NC - I work here, so I’m immersed in bleeding
edge stuff most of the time. :v)
Colin Burgess wrote:
It appears that you have to define -D_PTHREADS=1, otherwise the stl
default allocator is instantiated in a single-threaded mode, whereas
the lib was built with multithreading enabled.
I’m not sure why this isn’t on by default, but I’ll pass it on to the
compiler guys.
Cheers,
Colin
Jeff Strickrott wrote:
Hi Colin:
Yes I use QCC. My make file is included below. However, in trying to
compile the sample program I included earlier I tried both “qcc
-lang-c++” and “QCC”, same results. So is this just a problem
associated with 6.2.0 NC?
Thanks for the suggestion.
Regards
–Jeff Strickrott
=== Make from A Photon Application
Application Makefile
ifdef DBG
DBG_RELEASE = -O3 -fomit-frame-pointer
DBG_RELEASE = -O2
DBG_DEBUG = -O -gdwarf-2
DEBUG=$(DBG_$(DBG))
endif
ifndef DEBUG
DEBUG = -g
endif
ifndef OPTIM
OPTIM = -O
endif
include …/abOfiles
include …/indOfiles
include …/abSfiles
include …/indSfiles
include …/abHfiles
include …/indHfiles
include …/abWfiles
include …/abLfiles
PLATFORM=gcc_ntox86
PHABOPTS=
CC = QCC
CXX = QCC
LD = QCC
CFLAGS = -V$(PLATFORM) -w5 $(OPTIM) $(DEBUG) $(PHABOPTS) -I.
CXXFLAGS = $(CFLAGS)
LDFLAGS = -V$(PLATFORM) -fexceptions -Bstatic $(DEBUG) -l
efence -l phexlib $(ABLIB) $(PHABOPTS)
SDFLAGS = -V$(PLATFORM) -fexceptions $(DEBUG) -l malloc_g -l
phexlib $(ABLIB) $(PHABOPTS)
VPATH = …
Application Program
shr: $(ABOBJ) $(MYOBJ)
$(LD) $(ABOBJ) $(MYOBJ) $(SDFLAGS) -M -o BtView
usemsg BtView …/Usemsg
phabbind BtView $(ABMOD)
app: $(ABOBJ) $(MYOBJ)
$(LD) $(ABOBJ) $(MYOBJ) $(LDFLAGS) -M -o BtView
usemsg BtView …/Usemsg
phabbind BtView $(ABMOD)
clean:
rm -f *.o *.err *.map BtView
install:
-cp -vnf BtView /usr/photon/bin
Headers
$(ABOBJ) $(MYOBJ): $(MYHDR)
Prototype Generation
proto:
approto -p $(ABSRC) $(MYSRC) > proto.h
====== end Make
Colin Burgess wrote:
Make sure you LINK with QCC or qcc -lang-c++ too. This should tell
it to use the C++ libs.
Cheers,
Colin
Jeff Strickrott wrote:
Hi All:
I am having problems with linking when using C++ exceptions under
NC6.2.0 . I have searched the archives and the suggestion provided
do not work. I have included a sample program from one of the
previous threads to illustrate problem (see sample program below).
I have tried compiling with the following:
- QCC tmp.cpp,
- QCC -fexceptioons tmp.cpp,
- QCC -fexceptions -lang-c++ tmp.cpp,
and in a two step process with all above permutations.
In all situations I get the message :
tmp.o: In function main': tmp.o(.text+0x2a): undefined reference to
runtime_error::runtime_error(basic_st
ring<char, string_char_traits,
__default_alloc_template<false, 0> > const
&)’
For some reason the linker does not know that we need the runtime
libraries with exceptions. Can these be linked in manually?
Any other suggestions for what to try?
TIA
–Jeff Strickrott
CS Dept. FIU
South Florida
Sample app from a previous thread:
#include <iostream
#include <exception
#include <stdexcept
using namespace std; //I have compiled with and without this as
one thread //mentions libraries compiled without
namespace set
int main( int argc, char* argv[] )
{
try { throw runtime_error( “bad cheese” ); }
catch( runtime_error E ) { cout << "Error: " << E.what() << endl; }
return 0;
}
\
–
cburgess@qnx.com