Can't compile a 3 line C++ program

I am evaluating 6.3, and I can’t get the proverbial 3 liner to compile:

---- list.cc ----
#include
#include
#include
using namespace std;

int main(void)
{
list<string *> foo;
string bar(“BAR”);

foo.push_back(new string(bar));

cout << ((foo.begin())) << endl;
}

compiled with:

QCC -V3.3.1,gcc_ntox86 -o list list.cc

Errors:

/usr/qnx630/target/qnx6/usr/include/cpp/list: In instantiation of `std::list<std::string*, std::allocatorstd::string*

::const_iterator’:
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: instantiated from `std::list<std::string*, std::allocatorstd::string* >::iterator’

/usr/qnx630/target/qnx6/usr/include/cpp/list:456: instantiated from std::list<_Ty, _Ax>::iterator std::list<_Ty, _Ax>::end() [with _Ty = std::string*, _Ax = std::allocator<std::string*>]' /usr/qnx630/target/qnx6/usr/include/cpp/list:552: instantiated from void std::list<_Ty, _Ax>::push_back(const _Ty&) [with _Ty =
std::string*, _Ax = std::allocatorstd::string*]’
list.cc:11: instantiated from here
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: typedef class std::allocator<std::string*> std::_List_val<std::string*, std::allocator<std::string*> >::_Alty' is protected /usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this context /usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: typedef class
std::allocatorstd::string* std::_List_val<std::string*,
std::allocatorstd::string* >::_Alty’ is protected
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this context
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: `typedef class
std::allocatorstd::string* std::_List_val<std::string*,
std::allocatorstd::string* >::_Alty’ is protected
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this context
cc: /usr/qnx630/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/cc1plus error 1

What am I doing wrong ?

PR18061 fixed sometime around April, scheduled to go
out with SP1.

It’s actually a gcc3 bug but you can work around it
by changing _Alty to public in the list header.

Rennie Allen wrote:

I am evaluating 6.3, and I can’t get the proverbial 3 liner to compile:

---- list.cc ----
#include <list
#include <string
#include <iostream
using namespace std;

int main(void)
{
list<string *> foo;
string bar(“BAR”);

foo.push_back(new string(bar));

cout << ((foo.begin())) << endl;
}

compiled with:

QCC -V3.3.1,gcc_ntox86 -o list list.cc

Errors:

/usr/qnx630/target/qnx6/usr/include/cpp/list: In instantiation of
std::list<std::string*, std::allocator<std::string*> >::const_iterator': /usr/qnx630/target/qnx6/usr/include/cpp/list:456: instantiated from std::list<std::string*, std::allocatorstd::string* >::iterator’
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: instantiated from
std::list<_Ty, _Ax>::iterator std::list<_Ty, _Ax>::end() [with _Ty = std::string*, _Ax = std::allocator<std::string*>]' /usr/qnx630/target/qnx6/usr/include/cpp/list:552: instantiated from void std::list<_Ty, _Ax>::push_back(const _Ty&) [with _Ty =
std::string*, _Ax = std::allocatorstd::string*]’
list.cc:11: instantiated from here
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: typedef class std::allocator<std::string*> std::_List_val<std::string*, std::allocator<std::string*> >::_Alty' is protected /usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this context /usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: typedef class
std::allocatorstd::string* std::_List_val<std::string*,
std::allocatorstd::string* >::_Alty’ is protected
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this
context
/usr/qnx630/target/qnx6/usr/include/cpp/list:74: error: `typedef class
std::allocatorstd::string* std::_List_val<std::string*,
std::allocatorstd::string* >::_Alty’ is protected
/usr/qnx630/target/qnx6/usr/include/cpp/list:456: error: within this
context
cc:
/usr/qnx630/host/qnx6/x86/usr/lib/gcc-lib/i386-pc-nto-qnx6.3.0/3.3.1/cc1plus
error 1

What am I doing wrong ?

Garry Turcotte wrote:

PR18061 fixed sometime around April, scheduled to go
out with SP1.

It’s actually a gcc3 bug but you can work around it
by changing _Alty to public in the list header.

Thanks, however, now that I have progressed past compiling a 3 liner, our code (which of course runs on QNX6.2.1) crashes prior to
main in libstdcpp.so.5 GetFacet(). Any existing PRs for that ?

btw: Is there a PR database I can peruse (it would save me having to bother you :slight_smile:

Rennie

“Rennie Allen” <rallen@csical.com> wrote in message
news:4190119E.2090301@csical.com

Garry Turcotte wrote:
PR18061 fixed sometime around April, scheduled to go
out with SP1.

It’s actually a gcc3 bug but you can work around it
by changing _Alty to public in the list header.

Thanks, however, now that I have progressed past compiling a 3 liner, our
code (which of course runs on QNX6.2.1) crashes prior to main in
libstdcpp.so.5 GetFacet(). Any existing PRs for that ?

btw: Is there a PR database I can peruse (it would save me having to
bother you > :slight_smile:

I don’t think so, would expose “what they don’t want you to know”

Rennie
\

Mario Charest wrote:

“Rennie Allen” <> rallen@csical.com> > wrote in message
news:> 4190119E.2090301@csical.com> …

Garry Turcotte wrote:

PR18061 fixed sometime around April, scheduled to go
out with SP1.

It’s actually a gcc3 bug but you can work around it
by changing _Alty to public in the list header.

Thanks, however, now that I have progressed past compiling a 3 liner, our
code (which of course runs on QNX6.2.1) crashes prior to main in
libstdcpp.so.5 GetFacet(). Any existing PRs for that ?

Not that I know of. Check to make sure you’re using qcc, not g++;
the Dinkum headers, not the g++ ones; and linking with -lcpp, not -lstdc++
(you can have all sorts of trouble if you start mixing them…)

btw: Is there a PR database I can peruse (it would save me having to
bother you > :slight_smile:


I don’t think so, would expose “what they don’t want you to know”

:slight_smile:
They don’t let me out often, but I believe anyone with a service plan
can access bugs.qnx.com

Garry Turcotte wrote:

Mario Charest wrote:

“Rennie Allen” <> rallen@csical.com> > wrote in message
news:> 4190119E.2090301@csical.com> …

Garry Turcotte wrote:

PR18061 fixed sometime around April, scheduled to go
out with SP1.

It’s actually a gcc3 bug but you can work around it
by changing _Alty to public in the list header.


Thanks, however, now that I have progressed past compiling a 3 liner,
our code (which of course runs on QNX6.2.1) crashes prior to main in
libstdcpp.so.5 GetFacet(). Any existing PRs for that ?


Not that I know of. Check to make sure you’re using qcc, not g++;
the Dinkum headers, not the g++ ones; and linking with -lcpp, not -lstdc++
(you can have all sorts of trouble if you start mixing them…)

I am using Momentics (AKA the IDE) and I have set the compiler suite to 3.3.1 under the compiler tab. I have left the linker tab at
default.

btw: Is there a PR database I can peruse (it would save me having to
bother you > :slight_smile:



I don’t think so, would expose “what they don’t want you to know”


:slight_smile:
They don’t let me out often, but I believe anyone with a service plan
can access bugs.qnx.com

Cool…

Rennie