Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - C++ tuple issue: (6 Items)
   
C++ tuple issue  
Dear community

I'm trying to compile a piece of code based on C++ tuples. So in Momentix 4.7.0 I'm creating a new QNX C++ Project, 
adding my sources to project and try to compile. 

It fails on not being able to find <tuple> header, although the header seems to be there
  /qnx650/target/qnx6/usr/include/c++/4.4.2

Then I found somewhere on the forums I need to switch to "Link against CPP Library" to force -Y_gpp option and hence 
witch to right GPP C++ includes. Indeed this worked and it can see the "tuple" header. However it falls on the following
 now:

c++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C
++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options. 
    

So I tried to pass -std=gnu++0x (and -std=gnu++0x) to compiler options and neither worked. It fails with:

cc: unknown option: -std=gnu++0x

Any ideas?

Thanks   
Re: C++ tuple issue  
On 13-06-28 01:57 PM, Oleg V wrote:
> So I tried to pass -std=gnu++0x (and -std=gnu++0x) to compiler options and neither worked. It fails with:
>
> cc: unknown option: -std=gnu++0x

Try -Wc,-std=gnu++0x

Regards,

Ryan Mansfield

Re: C++ tuple issue  
That worked, thanks Ryan!
Re: C++ tuple issue  
Apparently it is not that simple ...

The code is full of C++ '11 stuff so I switched to "c++0x" option instead. That made C++ '11 dependent code happy but 
now posix timed mutex lock is not visible for whatever reason. It is filtered out by __EXT_POSIX1_200112. 

#if defined(__EXT_POSIX1_200112)		/* Approved 1003.1d D14 */
extern int pthread_mutex_timedlock(pthread_mutex_t *__mutex, const struct timespec *__abs_timeout);
#endif

Any idea why "gnu++0x" removes __EXT_POSIX1_200112? How do I fix that?
Re: C++ tuple issue  
More on the problem:

If I use "-std=gnu++0x" and Link Against CPP Library "GNU with exceptions" it doesn't compile C++ 11 stuff. 

If I use "-std=c++0x" and Link Against CPP Library "GNU with exceptions" it is screwing up POSIX includes.  

If I use "-std=c++0x" and Link Against CPP Library "Default" it doesn't see <tuple> header again.
 

So what do I do to have C++ '11,  C++ tuples and POSIX threads all at the same time?     

Thanks
Re: C++ tuple issue  
You must provide the -Y_gpp option to both the compiler and the linker to get C++11 library features.

I personally use -Wc,-std=gnu++0x rather than c++0x and all the features you want work for me.