Strange access violation exception with qt charts
-
Hello , i am having trouble compiling in visual studio 2017 any examples involving a QChart :
Unhandled exception at 0x00007FF90DBDCB4C (Qt5Gui.dll) in myproj.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
The weird part is that this error occurs whenever i create a QChart object (it doesn't matter where or when) so if i delete the line QChart *chart = new QChart(); from the example and add it in a separate class nothing changes . I have also created a new Qt project and added just the QChart module and the same thing happens.
I have found a way to run the code and i believe it has something to do with the files generated by QtCreator : open qt creator -> build the project -> run it -> now that the program is running in qt creator i can run it in visual studio too until i make any modifications in visual studio then the same problem happens.
Has anyone had this problem ? any help is welcome! -
Hi
Any chance you would have other Qt dlls in path ?
Creator sets up path to the Qt used to build the exe.
If VS do not use exact same paths , odd stuff can happen. -
@mrjj Hi and thank you for the reply , I'm not sure which path you're referring to .
"C:\Qt\5.10.1\msvc2017_64" this is the path that i have selected in the qt vs tools -> qt options so yes this path contains the dlls for the other modules -
@TheTugaOne
Hi
I mean from some other Qt application or multiple version of Qt etc.
It sounds like you/the app might find wrong version sometimes.
Else im not sure how it can work sometimes and sometimes not. -
@mrjj The application doesn't work constantly , as i mentioned every time i create a QChart object and i try to run it i get the access violation exception . What i wrote in the last paragraph is a workaround i found.
My problem is very similar to the one posted on this thread https://forum.qt.io/topic/84500/qt-charts-access-violation-exception which was also unresolved. -
If anyone is reading this in the future i managed to resolve the problem by removing qt5charts.dll from the additional dependencies ,leaving only qt5chartsd.dll . Steps: right click on project -> properties -> configuration properties ->linker -> input -> modify additional dependencies and remove Qt5Charts.dll
I'm not sure what the problem was so if anyone has any idea what caused the errors then please leave a reply. -
@TheTugaOne
Hi
The DLLS with d in name are debug version of the dll.Mixing release code and debug code can also crash.