Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - 4.2.1 and C++: (6 Items)
   
4.2.1 and C++  
Hi:

I know next to nothing about C++ but from what
I gather, this should work.

# cat tst.cc
#include <iostream>

class foo
{
        istream *foo;
};
# gcc tst.cc
tst.cc:1:20: error: iostream: No such file or directory
tst.cc:5: error: ISO C++ forbids declaration of 'istream' with no type
tst.cc:5: error: expected ';' before '*' token
# g++ tst.cc
tst.cc:1:20: error: iostream: No such file or directory
tst.cc:5: error: ISO C++ forbids declaration of 'istream' with no type
tst.cc:5: error: expected ';' before '*' token

Regards,

-seanb
Re: 4.2.1 and C++  
istream is in the std namespace.


It should be:

#include <iostream>

class foo
{
        std::istream *foo;
};


It looks like gcc misconfigured/improperly installed as well. The c++ headers should end up in $QNX_TARGET/usr/include/c
++/4.2.1 and the default include search dirs should look for them there. Run g++ -v tst.cc and see the default include 
paths then confirm the headers ended up in $QNX_TARGET/usr/include/c++/4.2.1

Regards,

Ryan Mansfield
Re: 4.2.1 and C++  
The headers are there but it looks like g++ has 6.3.0
hardcoded in it (I'm on 6.3.2).


localhost:/home/seanb >g++ -v tst.cc
Using built-in specs.
Target: i386-pc-nto-qnx6.3.0
Configured with: ../configure --srcdir=.. --build=i686-pc-linux-gnu --host=i386-
pc-nto-qnx6.3.0 --enable-cheaders=c --with-as=/opt/qnx630/host/linux/x86/usr/bin
/ntox86-as-2.17 --with-ld=/opt/qnx630/host/linux/x86/usr/bin/ntox86-ld-2.17 --wi
th-sysroot=/opt/qnx630/target/qnx6/ --disable-werror --libdir=/usr/qnx630/host/q
nx6/x86/usr/lib --libexecdir=/usr/qnx630/host/qnx6/x86/usr/lib --target=i386-pc-
nto-qnx6.3.0 --srcdir=/home/ryan/daily/new/gcc/trunk/nto-x86-o-ntox86/.. --prefi
x=/usr/qnx630/host/qnx6/x86/usr --exec-prefix=/usr/qnx630/host/qnx6/x86/usr --wi
th-local-prefix=/usr/qnx630/host/qnx6/x86/usr --enable-languages=c++ --enable-th
reads=posix --disable-nls --disable-libssp --disable-tls --enable-__cxa_atexit -
-with-gxx-include-dir=/usr/qnx630/target/qnx6/usr/include/c++/4.2.1 --enable-mul
tilib --enable-shared
Thread model: posix
gcc version 4.2.1
 /usr/qnx632/host/qnx6/x86/usr/lib/gcc/i386-pc-nto-qnx6.3.0/4.2.1/cc1plus -quiet
 -v -idirafter /usr/qnx632/target/qnx6/usr/include tst.cc -quiet -dumpbase tst.c
c -mtune=i386 -auxbase tst -version -o /tmp/cc52TB0a.s
ignoring nonexistent directory "/usr/qnx630/target/qnx6/usr/include/c++/4.2.1"
ignoring nonexistent directory "/usr/qnx630/target/qnx6/usr/include/c++/4.2.1/i3
86-pc-nto-qnx6.3.0"
ignoring nonexistent directory "/usr/qnx630/target/qnx6/usr/include/c++/4.2.1/ba
ckward"
ignoring nonexistent directory "/opt/qnx630/target/qnx6//usr/qnx630/host/qnx6/x8
6/usr/include"
ignoring nonexistent directory "/usr/qnx630/host/qnx6/x86/usr/lib/gcc/i386-pc-nt
o-qnx6.3.0/4.2.1/include"
ignoring nonexistent directory "/usr/qnx630/host/qnx6/x86/usr/i386-pc-nto-qnx6.3
.0/include"
ignoring nonexistent directory "/opt/qnx630/target/qnx6//usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/qnx632/target/qnx6/usr/include
End of search list.
GNU C++ version 4.2.1 (i386-pc-nto-qnx6.3.0)
        compiled by GNU C version 4.2.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: f43cd11407c67e684a66e4a2f3d36277
tst.cc:1:20: error: iostream: No such file or directory
tst.cc:5: error: ISO C++ forbids declaration of 'istream' with no type
tst.cc:5: error: expected ';' before '*' token
Re: 4.2.1 and C++  
> The headers are there but it looks like g++ has 6.3.0
> hardcoded in it (I'm on 6.3.2).

Those end up hardcoded in because the gcc driver was built on a 6.3.0 system but they go unused.  Part of our port of 
gcc, we make changes that allow gcc to be relocatable (based on QNX_HOST/QNX_TARGET) after it was built . For example, 
the driver you have, was built on an 6.3.0 machine, but the driver located /usr/qnx632/host/qnx6/x86/usr/lib/gcc/i386-pc
-nto-qnx6.3.0/4.2.1/cc1plus 
and searched  /usr/qnx632/target/qnx6/usr/include 

The gxx-include-dir isn't being properly relocated to $QNX_TARGET. I will fix this of course.

Thanks for the report Sean.

Regards,

Ryan Mansfield
Re: 4.2.1 and C++  
I got things moved along by temporarily linking
/usr/qnx630 -> /usr/qnx632

Next issue:

A c++ program got linked with a DT_NEEDED
of libstdc++.so.6 but this isn't in the CS_LIBPATH.
I had to link /lib/libstdc++.so.6 ->  /usr/qnx632/target/qnx6/x86/lib/gcc/4.2.1/libstdc++.so.6
Re: 4.2.1 and C++  
> I got things moved along by temporarily linking
> /usr/qnx630 -> /usr/qnx632
> 
> Next issue:
> 
> A c++ program got linked with a DT_NEEDED
> of libstdc++.so.6 but this isn't in the CS_LIBPATH.
> I had to link /lib/libstdc++.so.6 ->  /usr/qnx632/target/qnx6/x86/lib/gcc/4.2.
> 1/libstdc++.so.6


Is the above worth PRing?

-seanb