Found unsuitable Qt version "6.2.3" from C:/Qt/6.2.3/msvc2019_64/bin/qmake.exe

I am trying to setup OCCT from the github repo. I cloned and used cmake to generate Visual Studio projects. It is working fine till I add the option "BUILD_SAMPLES_QT". I have latest Qt installed which is 6.2.3. And it is giving me error
Found unsuitable Qt version "6.2.3" from C:/Qt/6.2.3/msvc2019_64/bin/qmake.exe

I have added following variables in cmake

3RDPARTY_QT_DIR = C:/Qt/6.2.3/msvc2019_64/bin/
QT_LRELEASE_EXECUTABLE = C:/Qt/6.2.3/msvc2019_64/bin/lrelease.exe
QT_QMAKE_EXECUTABLE = C:/Qt/6.2.3/msvc2019_64/bin/qmake.exe

So does it need Qt version 5 specifically? In the Third party component page, it is listed as Qt version 4.8.6. So can I use latest version or do I need to install 4.8.6? Or Qt5?


Rajendra Pardeshi's picture

Ok, I installed Qt 4.8.6 and cmake is happy and generating projects but now Visual Studio is complaining with linking errors.

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl QSizeF::QSizeF(double,double)" (__imp_??0QSizeF@@QEAA@NN@Z) referenced in function "protected: virtual class QRectF __cdecl Edge::boundingRect(void)const " (?boundingRect@Edge@@MEBA?AVQRectF@@XZ) FuncDemo D:\Work\OpenSrc\OCCT_FromGit\OCCT-build\samples\qt\FuncDemo\edge.obj 1

I added the path to the lib file in linker options. I think this is because Qt 4.8.6 is compiled with VS 2010 and I am using it in VS 2019. Is that the issue here? How to workaround this? This is so confusing... Library which has so many dependencies should explain the dependencies and not let users figure it out in the dark...

Kirill Gavrilov's picture

If you will install pre-built version of OCCT 7.6.0 from download section, you will see that it comes with Qt 5.11.2. I guess that Qt 4.x should work too, but it looks too outdated nowadays for new developments - you will need to patch the latest Qt 4.8.7 release to build using VS2015+. Anyway, core functionality of OCCT doesn't depend on Qt, so I wouldn't waste much time on this dependency as long as you don't need Inspector tool (useful for debugging OCCT-based application) or Qt samples.

I think this is because Qt 4.8.6 is compiled with VS 2010 and I am using it in VS 2019.

You log doesn't look like issue of VS mismatch, but yes - you wouldn't able to mix VS2010 and VS2019 DLLs of C++ libraries as they have incompatible binary interface. VS2015/VS2017/VS2019/VS2022 should have compatible DLLs according to MSDN.

I have latest Qt installed which is 6.2.3

So far, I haven't heard much about using Qt6 with OCCT, though I guess that it should be technically compatible with some porting efforts. I guess that at minimum CMake scripts should be updated to handle Qt6 as currently adm/cmake/qt.cmake looks only for Qt5 and then Qt4:

if (NOT ${Qt5_FOUND})
  # Now we can apply standard CMake finder for Qt. We do this mostly
  # to have qt4_wrap_cpp() function available

I've seen also some complains about numerous issues with Qt6 in CMake...

Rajendra Pardeshi's picture

Thank you Kirill for your reply.

Actually I also tried with Qt 5.12.11 and it gave me same error -

Found unsuitable Qt version "5.12.11" from C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/bin/qmake.exe

So not sure how to get Qt dependency working. And I want to get it working because I want to take a loot at Qt samples to get idea about an app based on Qt that I am trying to write. I want to work with code from github repo (instead of OpenCascade binaries) because I want to develop app based on OpenCascade and I want to peek into the code/implementation of the library. I have been able to setup the repo with MFC samples and everything else is working - only Qt samples are giving me problems.

So what could go wrong with Qt 5.12.11 that is giving me this error?

This is the error logged

Info: AndroidQt sample excluded due to OS is not Windows or Qt is configured without ANGLE
Info: (20:32:49) qt Sample projects added
CMake Error at adm/cmake/occt_toolkit.cmake:35 (include_directories):
include_directories given empty-string as include directory.
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
samples/qt/FuncDemo/CMakeLists.txt:4 (OCCT_INCLUDE_CMAKE_FILE)

CMake Error at adm/cmake/qt_macro.cmake:48 (qt4_wrap_cpp):
Unknown CMake command "qt4_wrap_cpp".
Call Stack (most recent call first):
adm/cmake/occt_toolkit.cmake:222 (FIND_AND_WRAP_MOC_FILES)
CMakeLists.txt:14 (include)
samples/qt/FuncDemo/CMakeLists.txt:4 (OCCT_INCLUDE_CMAKE_FILE)

I mentioned Following Qt dirs:
Qt5_DIR - C:\Qt\Qt5.12.11\5.12.11\msvc2017_64\bin
3RDPARTY_QT_DIT - C:\Qt\Qt5.12.11\5.12.11\msvc2017_64\bin

Any way to resolve this?

Kirill Gavrilov's picture

I'm not much skillful with CMake, but if you have several Qt versions at hand - make sure that CMake didn't cached a mixture of different Qt installations in variables. I've seen that in my experience and have to manually delete all related Qt variables in CMake-GUI to make it working.

What about simpler external Qt samples for OCCT - do they give you the same errors?

Rajendra Pardeshi's picture

For now, I have moved to MFC samples as I can make a demo app using MFC quicker instead of wasting time on getting Qt to work. Just a suggestion - OCCT should follow the approach taken by FreeCAD - they provide a libpack where all dependencies can be downloaded in a single zip file ( - that is some straight forward way to providing dependencies instead of giving links some of which don't even work. Time spent answering forum questions is way more than time spent on creating that single zip file so that there are no more questions on why this or that is not working.

Kirill Gavrilov's picture

that is some straight forward way to providing dependencies instead of giving links some of which don't even work.

Could you please comment which links don't work to fix them?

Just a suggestion - OCCT should follow the approach taken by FreeCAD

First of all, there is a "libpack" for OCCT - the windows setup package you have just installed. But it is misconception. FreeCAD is an end-user application, so that FreeCAD developers know more or less well which dependencies should be used for building it. OCCT is a framework, and most dependencies are optional - so that you should be able to build the core of OCCT framework with almost no other libraries, and there is no way to foresee and no need to push or encourage all developers of OCCT-based applications to use all optional stuff.

Time spent answering forum questions is way more than time spent on creating that single zip file so that there are no more questions on why this or that is not working.

...and then somebody downloads this big all-in-one libpack archive, tries to actually use it, and questions appear like why some debug libraries are outdated within libpack, why I cannot build debug version of application, how to rebuild/update a particular library with newer/patched version, how to reproduce exactly the same binaries as in archives, why it is for Visual Studio N while I need Visual Studio M, why this library is built with this useless dependency, and so on and so on.

Rajendra Pardeshi's picture

I just installed OpenCasCade 7.6.0 using windows installer and it is not launching the DRAWEXE.exe. I am getting message that tbbmalloc.dll is not found. This dll is right there in C:\Program Files\OpenCASCADE-7.6.0-vc14-64\tbb_2017.0.100\bin\intel64\vc14. So even the installer has issues. What did installer do? Just copied all files to a folder? Who is gonna resolve and establish connections of where who is? I expect when installer is finished, it should launch what it installed in 2022 not tell me to go fetch some dlls because it did half job. Setup for this lib is really not up to the mark.

Kirill Gavrilov's picture

How exactly are you trying to start DRAWEXE.exe? From a link in Start menu? Using draw.bat in installation folder?

Rajendra Pardeshi's picture

First of all, thank you Kirill for responding with your answers, I appreciate it.

I have to say it was a really frustrating day when anything I try was simply not working.

Second, I want to apologize that I said that some of link is not working. It was another library which I am trying along with OCCT which had that issue and I mixed the two up. So links are fine.

But I still think libpack is a better option because then we have a consistent way of solving problems. I will offer my view to issues you raised - Yes, the windows setup package is a libpack and it would be better if dependencies form this installation are available as a optional zip inside github. So I am not saying to put it as a mandatory but for folks who want to see the samples/other optional stuff which many of who are starting out will do to see how it is working, it can be an option. And then you will have consistent set of problems to solve - updating the dependencies with latest. And then for folks who want to try with a specific flavor, there is always option to get the specific flavor from web or build one from the source of the lib if available. But that is just my opinion.

I was trying to launch DRAWEXE.exe directly from the installed folder. But when I tried draw.bat, it is working. Thanks.