Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - incompatabilities found with GNU gcc STL code: (4 Items)
   
incompatabilities found with GNU gcc STL code  
I have some C++ code that uses STL heavily, and it compiles correctly on GNU gcc 4.2, 4.3, 4.4, and 4.5 on Ubuntu linux.
 It also compiles correctly on Microsoft MSVC 2008.

However, I cannot get it to compile using the 4.8.0 Momentics Tools (build # 201105051724).

I haven't figured out how to select the STL library to use.
My best guess so far is:
from Project Properties-->C/C++ Build-->Settings:
choose the Tool Settings tab, and select Target:
then choose the Runtime from the combo box.
I have tried both C++ GNU with exceptions, and C++ Dinkum with exceptions,
but I still get errors regarding my iterators.

The errors are mostly one of:
error: no type named 'iterator_category' in class <such and such>
error: no type named 'value_type' in class <such and such>
error: no type named 'difference_type' in class <such and such>
error: no type named 'pointer' in class <such and such>
error: no type named 'reference' in class <such and such>

Since Momentics is built on gcc, and I can compile this code under linux using the above listed versions, I believe my 
code is fine, and there must be some configuration item I can change to get my code to build.

I welcome any suggestions.
Thanks

Re: incompatabilities found with GNU gcc STL code  
On 11-10-25 04:37 PM, Peter Snider wrote:
> I have some C++ code that uses STL heavily, and it compiles correctly on GNU gcc 4.2, 4.3, 4.4, and 4.5 on Ubuntu 
linux. It also compiles correctly on Microsoft MSVC 2008.
>
> However, I cannot get it to compile using the 4.8.0 Momentics Tools (build # 201105051724).
>
> I haven't figured out how to select the STL library to use.
> My best guess so far is:
> from Project Properties-->C/C++ Build-->Settings:
> choose the Tool Settings tab, and select Target:
> then choose the Runtime from the combo box.
> I have tried both C++ GNU with exceptions, and C++ Dinkum with exceptions,
> but I still get errors regarding my iterators.
>
> The errors are mostly one of:
> error: no type named 'iterator_category' in class<such and such>
> error: no type named 'value_type' in class<such and such>
> error: no type named 'difference_type' in class<such and such>
> error: no type named 'pointer' in class<such and such>
> error: no type named 'reference' in class<such and such>
>
> Since Momentics is built on gcc, and I can compile this code under linux using the above listed versions, I believe my
 code is fine, and there must be some configuration item I can change to get my code to build.

Can you post an example?

Regards,

Ryan Mansfield
Re: incompatabilities found with GNU gcc STL code  
I have made a code modification that satisfies the compiler, so I can proceed.

However, I would still like to know if there is a configuration option that I could have set to be able to compile the 
original code.

My modification is to add the missing types at the start of my iterator class declaration:

// this is a nested class within my own templated container
 class iterator
 {
   public:
     typedef T value_type;
     typedef int difference_type;
     typedef T * pointer;
     typedef T & reference;
     typedef std::random_access_iterator_tag iterator_category;

   public:
      iterator ()  {}

 
Re: incompatabilities found with GNU gcc STL code  
I forgot to mention that I also added the standard header file for iterators:
#include <iterator>