"emerge nethack" fails while building qt_win.cpp: g++ -mcpu=athlon-xp -O3 -pipe -I../include -I../include -I../include -I. -I/usr/qt/3/include -c ../win/Qt/qt_win.cpp In file included from ../include/qt_win.h:33, from ../win/Qt/qt_win.cpp:78: /usr/qt/3/include/qlistview.h:550: error: parse error before `(' token /usr/qt/3/include/qlistview.h:563: error: missing ';' before right brace /usr/qt/3/include/qlistview.h:565: error: parse error before `)' token /usr/qt/3/include/qlistview.h:566: error: parse error before `*' token /usr/qt/3/include/qlistview.h:567: error: parse error before `*' token /usr/qt/3/include/qlistview.h:569: error: parse error before `const' /usr/qt/3/include/qlistview.h:570: error: parse error before `*' token /usr/qt/3/include/qlistview.h:571: error: parse error before `*' token /usr/qt/3/include/qlistview.h:573: error: `QListViewItemIterator& operator=(const QListViewItemIterator&)' must be a nonstatic member function /usr/qt/3/include/qlistview.h:573: error: `QListViewItemIterator& operator=(const QListViewItemIterator&)' must take exactly two arguments /usr/qt/3/include/qlistview.h:575: error: destructors must be member functions /usr/qt/3/include/qlistview.h:577: error: syntax error before `&' token /usr/qt/3/include/qlistview.h:578: error: syntax error before `operator' /usr/qt/3/include/qlistview.h:579: error: syntax error before `&' token /usr/qt/3/include/qlistview.h:581: error: syntax error before `&' token /usr/qt/3/include/qlistview.h:582: error: syntax error before `operator' /usr/qt/3/include/qlistview.h:583: error: syntax error before `&' token /usr/qt/3/include/qlistview.h:585: error: `QListViewItem* operator*()' must have an argument of class or enumerated type /usr/qt/3/include/qlistview.h:585: error: `QListViewItem* operator*()' must take either one or two arguments /usr/qt/3/include/qlistview.h:586: error: non-member function `QListViewItem* current()' cannot have `const' method qualifier /usr/qt/3/include/qlistview.h:588: error: parse error before `protected' /usr/qt/3/include/qlistview.h:592: error: parse error before `private' /usr/qt/3/include/qlistview.h:597: error: non-member function `bool matchesFlags(const QListViewItem*)' cannot have `const' method qualifier /usr/qt/3/include/qlistview.h:598: error: non-member function `bool testPair(QListViewItemIterator::IteratorFlag, QListViewItemIterator::IteratorFlag, bool)' cannot have `const' method qualifier /usr/qt/3/include/qlistview.h:599: error: non-member function `bool isChecked(const QListViewItem*)' cannot have `const' method qualifier /usr/qt/3/include/qlistview.h:600: error: parse error before `}' token make: *** [qt_win.o] Error 1 Reproducible: Always Steps to Reproduce: 1. emerge nethack Actual Results: See details. Expected Results: Working nethack binary, for hours of frustrating game play. :-) Portage 2.0.49-r7 (default-x86-1.4, gcc-3.3.1, glibc-2.3.2-r1, 2.6.0-test5-bk11) ================================================================= System uname: 2.6.0-test5-bk11 i686 AMD Athlon(tm) XP 1800+ ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CFLAGS="-mcpu=athlon-xp -O3 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/share/config" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-mcpu=athlon-xp -O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="sandbox ccache autoaddcvs" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 oss apm avi crypt cups encode foomaticdb gif jpeg libg++ libwww mad mikmod mmx mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib gdbm berkdb slang readline arts svga java sdl gpm tcpd pam ssl perl python esd imlib oggvorbis qt motif opengl mozilla cdr X gtk kde -gnome -alsa"
This error is caused by nethack defining a macro called Invisible. From include/yourprop.h: #define Invisible (Invis && !See_invisible) But the qlistview.h header file has a variable called Invisible: enum IteratorFlag { Visible = 0x00000001, Invisible = 0x00000002, Selected = 0x00000004, ..... The pre-processor replaces all occurences of this variable with (Invis && !See_invisible) which causes the compile to fail. If the Invisible macro is undefined before qlistview.h is included then nethack compiles ok.
Created attachment 18479 [details, diff] proposed nethack-qt-3.1.4 patch This patch will allow nethack-3.4.2 to compile using qt-3.1.4 It won't break compatibility with earlier versions of qt. (It may be worthwhile incorporating this with the current qt-support patch)
The proposed nethack-qt-3.1.4 patch works for me.
thats weird, i'm using x11-libs/qt-3.2.1-r2 and nethack has always emerged just fine & dandy ... but since the patch doesnt make a difference on my side and you guys say it works for you ive added it cvs thx brandy