Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - QNX 6.6.0 C++ / std::exception::what() returns string with length 0: (1 Item)
   
QNX 6.6.0 C++ / std::exception::what() returns string with length 0  
Hi,

I'm using QNX 6.6.0 and, as development host, Windows 7.
I found out, that std::exception::what() returns a string of length 0 (empty string) in case
of an exception.
This is the source code of my small program (the project is zipped an attached to this post):
--------------------------------------------------
#include <iostream.h>

int main(int argc, char *argv[]) {
	class Base { virtual void member() {} };
	class Derived : Base {};
	try
	{
		Base bx;
		Derived& rd2 = dynamic_cast<Derived&>(bx); // always ends in throwing the exception bad_cast
	}
	catch (const std::exception& Exception)
	{
		std::cerr << "bad_cast caught: \"" << Exception.what() << "\"\n";
	}
	return EXIT_SUCCESS;
}
--------------------------------------------------
With QNX 6.6, I get the output:
bad_cast caught: ""
With QNX 6.5 (identical project and identical source files, but environment variables MAKEFLAGS/PATH/QNX_HOST/QNX_TARGET
 changed to point to my QNX 6.5.0SP1 installation):
bad_cast caught: "bad cast"

I created a QNX Momentics C++ project without a further adaption of compiler- or linkerflags.

So what went wrong here?

(here is the make output when building with QNX 6.6.0:
D:\qnx660\workspace\hello_exepp>make
make -j 1 -Cx86 -fMakefile
make[1]: Entering directory `D:/qnx660/workspace/hello_exepp/x86'
make -j 1 -Co -fMakefile
make[2]: Entering directory `D:/qnx660/workspace/hello_exepp/x86/o'
d:/QNX660/host/win32/x86/usr/bin/qcc -Vgcc_ntox86 -c -Wc,-Wall  -Os -vv
 -DNDEBUG    -I. -ID:/qnx660/workspace/hello_exepp/x86/o -ID:/qnx660/workspace/h
ello_exepp/x86 -ID:/qnx660/workspace/hello_exepp -Id:/QNX660/target/qnx6/usr/inc
lude     -DBUILDENV_qss   D:/qnx660/workspace/hello_exepp/hello_exepp.cc
cc: looking for gcc_ntox86 in d:/QNX660/host/win32/x86/etc/qcc/gcc/4.7.3/gcc_nto
x86++.conf
cc: looking for gcc_ntox86 in d:/QNX660/host/win32/x86/etc/qcc/gcc/4.7.3/gcc_nto
x86.conf
d:/QNX660/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.6.0/4.7.3/cc1plus -Os -DND
EBUG -I. -ID:/qnx660/workspace/hello_exepp/x86/o -ID:/qnx660/workspace/hello_exe
pp/x86 -ID:/qnx660/workspace/hello_exepp -Id:/QNX660/target/qnx6/usr/include -DB
UILDENV_qss -quiet -fstack-protector-strong -march=i486 -nostdinc -nostdinc++ -s
td=gnu++11 -D__QNX__ -D__QNXNTO__ -D__GNUC__=4 -D__GNUC_MINOR__=7 -D__GNUC_PATCH
LEVEL__=3 -D__NO_INLINE__ -D__DEPRECATED -D__EXCEPTIONS -D__unix__ -D__unix -D__
ELF__ -D__X86__ -D__i386__ -march=i486 -D__LITTLEENDIAN__ -Wall -isystem d:/QNX6
60/target/qnx6/usr/include -isystem d:/QNX660/host/win32/x86/usr/lib/gcc/i486-pc
-nto-qnx6.6.0/4.7.3/include -isystem d:/QNX660/target/qnx6/usr/include/cpp/c -is
ystem d:/QNX660/target/qnx6/usr/include/cpp D:/qnx660/workspace/hello_exepp/hell
o_exepp.cc -dumpbase D:/qnx660/workspace/hello_exepp/hello_exepp.cc -o C:\Users\
z0027ttc\AppData\Local\Temp\2qccLixj58\hello_exepp.s
D:/qnx660/workspace/hello_exepp/hello_exepp.cc: In function 'int main(int, char*
*)':
D:/qnx660/workspace/hello_exepp/hello_exepp.cc:14:43: warning: dynamic_cast of '
main(int, char**)::Base bx' to 'class main(int, char**)::Derived&' can never suc
ceed [enabled by default]
D:/qnx660/workspace/hello_exepp/hello_exepp.cc:14:12: warning: unused variable '
rd2' [-Wunused-variable]
d:/QNX660/host/win32/x86/usr/bin/i486-pc-nto-qnx6.6.0-as C:\Users\z0027ttc\AppDa
ta\Local\Temp\2qccLixj58\hello_exepp.s -o hello_exepp.o
cc: unlinking C:\Users\z0027ttc\AppData\Local\Temp\2qccLixj58\hello_exepp.s
cc: removing  C:\Users\z0027ttc\AppData\Local\Temp\2qccLixj58
d:/QNX660/host/win32/x86/usr/bin/rm -f  D:/qnx660/workspace/hello_exepp/x86/o/he
llo_exepp
d:/QNX660/host/win32/x86/usr/bin/qcc -Vgcc_ntox86  -lang-c++ -lang-c++ -vv    -o
 D:/qnx660/workspace/hello_exepp/x86/o/hello_exepp    hello_exepp.o   -L . -L d:
/QNX660/target/qnx6/x86/lib -L d:/QNX660/target/qnx6/x86/usr/lib  -Wl,--rpath-li
nk . -Wl,--rpath-link d:/QNX660/target/qnx6/x86/lib -Wl,--rpath-link...
View Full Message
Attachment: Compressed file hello_exepp.zip 148.11 KB