[zypp-devel] compilation problem with libzypp in SLES11
Hello, I have a problem compiling an application (kde4-kupdateapplet) to which I'm adding some code that uses libzypp. When compiling, I'm getting this error: http://paste.opensuse.org/36038415 It seems to be related to the for_ definition in libzypp 9.37.10-0.8.1.10 (which is what SLES11-SP3 is using) as: #define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT ) I saw that in libzypp 14.32.0, for_ is also defined using auto instead of typeof, so I tried changing the definition to #define for_(IT,BEG,END) for ( auto IT = BEG, _for_end = END; IT != _for_end; ++IT ) and then I got a different error: /usr/include/zypp/base/String.h: In function ‘std::string zypp::str::joinEscaped(_Iterator, _Iterator, char)’: /usr/include/zypp/base/String.h:661: error: invalid type argument of ‘unary *’ /usr/include/zypp/base/String.h:667: error: invalid type argument of ‘unary *’ /usr/include/zypp/base/String.h:670: error: invalid type argument of ‘unary *’ /usr/include/zypp/base/String.h:672: error: invalid type argument of ‘unary *’ Also, libzypp 9.37.10 compiles fine in SLES11-SP3, so I'm inclined to thinking that it should compile fine with the original definition and the problem is a missing compiler flag, preprocessor definition or #include, but I'm unable to find the cause. Can anyone tell me what's wrong there? Thanks! PS: Please, keep me in CC since I'm not subscribed to this list -- Antonio Larrosa -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
On Thursday 05 March 2015 12:39:14 Antonio Larrosa wrote:
Hello,
I have a problem compiling an application (kde4-kupdateapplet) to which I'm adding some code that uses libzypp. When compiling, I'm getting this error: http://paste.opensuse.org/36038415
It seems to be related to the for_ definition in libzypp 9.37.10-0.8.1.10 (which is what SLES11-SP3 is using) as:
#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT )
Sorry, my fault. [https://gcc.gnu.org/onlinedocs/gcc/Typeof.html] ... If you are writing a header file that must work when included in ISO C programs, write __typeof__ instead of typeof. 'typeof' is a gcc extension. It's turned off because you're using 'c++ -ansi'. - Either drop using -ansi - or change the header to use __typeof__ - or maybe #define typeof __typeof__ #include <zypp/ZYppFactory.h> -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres SUSE LINUX GmbH, Development, ma@suse.de Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 74 053-0 +------------------------------------------------------------------+ SUSE Linux GmbH GF: Felix Imendörffer, Jane Smithard, Jennifer Guild Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg) +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
On 03/05/2015 01:47 PM, Michael Andres wrote:
[https://gcc.gnu.org/onlinedocs/gcc/Typeof.html] ... If you are writing a header file that must work when included in ISO C programs, write __typeof__ instead of typeof.
'typeof' is a gcc extension. It's turned off because you're using 'c++ -ansi'.
Ah, I tried adding -std=c++0x ( c++11 wasn't available in this compiler version) but didn't notice -ansi in the compiler line. Just for curiosity I tried now using -std=gnu++0x and it works too. I'll use the "#define typeof __typeof__" solution, which works fine. Thanks! -- Antonio Larrosa -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
participants (2)
-
Antonio Larrosa
-
Michael Andres