Handling Exception: third party library
-
First of all, I read other posts about Qt and Exceptions (like this), but I not found a solution to my case.
I'm using a third party C++ library called HighFive (github link) in my Qt GUI project to write and read data in HDF5 format.
It's working. I can read and write data with this.
The problem is that: Every time when I try to read/write data using this library, the library emit a exception and Qt Creator IDE shows it in a GUI popup window and I can't catch it in atry/catch
block.
This simple example below is a completly new Qt Console application project created just to test thetry/catch
block:int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); // Create a HDF5 file on disk: H5Easy::File file("test.h5", H5Easy::File::Overwrite); // Create some data: std::vector<double> data = { 1, 2, 3, 4, 5 }; // Try to write data into the HDF5 file: try { H5Easy::dump(file, "/path/to/my/data", data); } catch (...) { qDebug() << "I CATCH A EXCEPTION"; } return app.exec(); }
When the debugger hits the line:
H5Easy::dump(file, "/path/to/my/data", data);
The debugger goes to a internal HighFive library file that emits the exception (GUI popup window):
What can I do inside my
main.cpp
to handle this exception and not get this popup window above?PS.: I talked to the HighFive team about it. They asked me to test the same example using Microsoft Visual Studio 2019 and it works great without erros or exceptions. So they think that this case is about some special configuration on the Qt Creator IDE.
You can see the discussion here.My system:
- Windows 10 x64
- Qt Creator IDE 4.10.1 (32 bits)
- Visual Studio 2019 Enterprise
Compiler and Debugger:
Again: All is working! I just want to "disable/mute" this exceptions or catch it in a
try/catch
block.
How can I do that? -
Hi,
One thing that is indeed different is the debugger. Unless it changed recently, the Visual Studio debugger was only available to Visual Studio itself. You had to install a standalone debugger which might be different that the one embedded in Visual Studio.
-
Hi,
One thing that is indeed different is the debugger. Unless it changed recently, the Visual Studio debugger was only available to Visual Studio itself. You had to install a standalone debugger which might be different that the one embedded in Visual Studio.
-
As I said, things may have changed with VS2019. Do you remember its installation ?
-
Are you talking about the Qt installation or the VS2019 one ?