# 'unknown type name QT6\_VIRTUAL' on MacOS

**URL:** <https://geant4-forum.web.cern.ch/t/unknown-type-name-qt6-virtual-on-macos/12857>\
**Category:** Getting Started\
**Created:** [August 27, 2024, 8:15pm UTC](https://geant4-forum.web.cern.ch/t/unknown-type-name-qt6-virtual-on-macos/12857 "2024-08-27T20:15:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prebys](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/prebys/32/7203_2.png) [@prebys](https://geant4-forum.web.cern.ch/u/prebys)\
**Post date:** [August 27, 2024, 8:15pm UTC](https://geant4-forum.web.cern.ch/t/unknown-type-name-qt6-virtual-on-macos/12857/1 "2024-08-27T20:15:24Z")

</div>

Please fill out the following information to help in answering your question, and also see [tips for posting code snippets](https://geant4-forum.web.cern.ch/t/how-to-post-code-snippets/9944). If you don’t provide this information it will take more time to help with your problem!

\_Geant4 Version: 11.2.2  
\_Operating System: MacOS Sonoma 14.6.1  
\_Compiler/Version: clang 12.0.0  
\_CMake Version: 3.30.2

I’m trying to build Geant4 on my Mac. This has worked before. Most of my packages were installed with homebrew and I just updated all of them. I built and installed CLHEP by hand (based on prior experience). I then configured cmake with the following (key) options shown at the bottom. Then I try to make geant4, and it dies with the following error:

[23%] Building CXX object source/CMakeFiles/G4digits\_hits.dir/digits\_hits/detector/src/G4CellScoreComposer.cc.o  
In file included from /Users/prebys/installations/geant4/source/interfaces/implementation/src/G4UIQt.cc:49:  
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qlayout.h:129:5: error:  
unknown type name ‘QT6\_VIRTUAL’  
QT6\_VIRTUAL int indexOf(QLayoutItem \*) const;  
^  
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qlayout.h:134:5: error:  
unknown type name ‘QT6\_VIRTUAL’  
QT6\_VIRTUAL QLayoutItem \*replaceWidget(QWidget \*from, QWidget \*to,  
^  
/usr/local/opt/qt5/lib/QtWidgets.framework/Headers/qlayout.h:134:28: error:  
expected ‘;’ at end of declaration list  
QT6\_VIRTUAL QLayoutItem \*replaceWidget(QWidget \*from, QWidget \*to,

I do have both qt5 and qt6 installed, but it should be looking only in the qt5 directory.

Any advice would be appreciated!

-Eric

## cmake info…

CLHEP\_DIR /usr/local/lib/CLHEP-2.4.7.1  
CMAKE\_BUILD\_TYPE Release  
CMAKE\_INSTALL\_PREFIX /usr/local  
CMAKE\_OSX\_ARCHITECTURES  
CMAKE\_OSX\_DEPLOYMENT\_TARGET  
CMAKE\_OSX\_SYSROOT /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk  
GEANT4\_BUILD\_MULTITHREADED OFF  
GEANT4\_INSTALL\_DATA ON  
GEANT4\_INSTALL\_DATADIR  
GEANT4\_USE\_G3TOG4 OFF  
GEANT4\_USE\_GDML ON  
GEANT4\_USE\_INVENTOR OFF  
GEANT4\_USE\_INVENTOR\_QT OFF  
GEANT4\_USE\_OPENGL\_X11 ON  
GEANT4\_USE\_QT ON  
GEANT4\_USE\_RAYTRACER\_X11 ON  
GEANT4\_USE\_SYSTEM\_CLHEP ON  
GEANT4\_USE\_SYSTEM\_EXPAT ON  
GEANT4\_USE\_SYSTEM\_ZLIB OFF  
GEANT4\_USE\_VTK OFF  
GEANT4\_USE\_XM ON  
QT\_DIR /usr/local/opt/qt5/lib/cmake/Qt5  
Qt53DCore\_DIR /usr/local/opt/qt5/lib/cmake/Qt53DCore  
Qt53DExtras\_DIR /usr/local/opt/qt5/lib/cmake/Qt53DExtras  
Qt53DInput\_DIR /usr/local/opt/qt5/lib/cmake/Qt53DInput  
Qt53DLogic\_DIR /usr/local/opt/qt5/lib/cmake/Qt53DLogic  
Qt53DRender\_DIR /usr/local/opt/qt5/lib/cmake/Qt53DRender  
Qt5Core\_DIR /usr/local/opt/qt5/lib/cmake/Qt5Core  
Qt5Gamepad\_DIR /usr/local/opt/qt5/lib/cmake/Qt5Gamepad  
Qt5Gui\_DIR /usr/local/opt/qt5/lib/cmake/Qt5Gui  
Qt5Network\_DIR /usr/local/opt/qt5/lib/cmake/Qt5Network  
Qt5OpenGL\_DIR /usr/local/opt/qt5/lib/cmake/Qt5OpenGL  
Qt5Widgets\_DIR /usr/local/opt/qt5/lib/cmake/Qt5Widgets  
Qt5\_DIR /usr/local/opt/qt5/lib/cmake/Qt5  
X11\_xcb\_xkb\_INCLUDE\_PATH /usr/local/include

* * *

---

<div class="post-metadata">

**Author:** ![allison](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allison](https://geant4-forum.web.cern.ch/u/allison)\
**Post date:** [August 27, 2024, 9:26pm UTC](https://geant4-forum.web.cern.ch/t/unknown-type-name-qt6-virtual-on-macos/12857/2 "2024-08-27T21:26:41Z")

</div>

Hi Eric

If you have both Qt5 and Qt6 installed with homebrew, for Qt5 you have to:  
brew unlink qt  
(Don’t ask me why.)

Does this help?  
John

P.S. “brew link qt” if you build with Qt6.

---

<div class="post-metadata">

**Author:** ![prebys](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/prebys/32/7203_2.png) [@prebys](https://geant4-forum.web.cern.ch/u/prebys)\
**Post date:** [August 27, 2024, 11:16pm UTC](https://geant4-forum.web.cern.ch/t/unknown-type-name-qt6-virtual-on-macos/12857/3 "2024-08-27T23:16:08Z")

</div>

Thanks!

That wast he magic bullet to get it to build.

Now on to the next problem…

---

<div class="post-metadata">

**Author:** ![system](https://geant4-forum.web.cern.ch/uploads/default/original/1X/ce519a43ebdf7ac48a98a03c6ad6eea013b68c46.png) [@system](https://geant4-forum.web.cern.ch/u/system)\
**Post date:** [September 26, 2024, 11:16pm UTC](https://geant4-forum.web.cern.ch/t/unknown-type-name-qt6-virtual-on-macos/12857/4 "2024-09-26T23:16:21Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
