QT Debugging fails on Windows
-
Recently after installinf Qt version 6.6.1, I no longer can run or debug my program. The program compiles and links ok but will not run. I am running on Windows 10 Pro with Visual Studio 2022 installed (and upgrades to the latest version).
This screenshot shows the results of first running the program and second trying to debug. Please note the multiple "Launching debugger" progress bars. They won't go away.
Here is a screenshot of my Build settings:
I also have the same problem with Qt 5.15.2 as well.
Any help on resolving this program will be appreciated.
-
C Christian Ehrlicher moved this topic from General and Desktop on
-
@cristian-adam As I reported earlier, I believed the problem had to do with the code that uses sqlite3_create_function to create a sqlit3 function which means that my cpp file needs to include "sqlite3.h". Furthermore, this file needs to be the same as that used in the particular Qt version.
Here is my code to do this:
void distanceFunc(sqlite3_context* ctx, int argc, sqlite3_value **argv) { double Lat1, Lon1, Lat2, Lon2; Lat1 = sqlite3_value_double(argv[0]); Lon1 = sqlite3_value_double(argv[1]); Lat2 = sqlite3_value_double(argv[2]); Lon2 = sqlite3_value_double(argv[3]); // sqlite3_result_value(distance(LatLng(a1,a2),LatLng(a3,a4))); if (Lat1 == Lat2 && Lon1 == Lon2) sqlite3_result_double(ctx,0); double R = 6371; // RADIUS OF THE EARTH IN KM double dToRad = 0.0174532925; double lat1 = Lat1 * dToRad; //double lon1 = Lon1 * dToRad; double lat2 = Lat2 * dToRad; //double lon2 = Lon2 * dToRad; double dLat = dToRad * (Lat2 - Lat1); double dLon = dToRad * (Lon2 - Lon1); double a = qSin(dLat / 2) * qSin(dLat / 2) + qCos(lat1) * qCos(lat2) * qSin(dLon / 2) * qSin(dLon / 2); double c = 2 * qAtan2(qSqrt(a), qSqrt(1 - a)); double d = R * c; sqlite3_result_double(ctx,d); // distance in kilometers } bool SQL::loadSqlite3Functions(QSqlDatabase db) { QVariant v = db.driver()->handle(); sqlite3 *db_handle = NULL; if (v.isValid() && strcmp(v.typeName(), "sqlite3*") == 0) { // v.data() returns a pointer to the handle db_handle = *static_cast<sqlite3 **>(v.data()); if (!db_handle) { qCritical() <<"Cannot get a sqlite3 handler."; return false; } sqlite3_initialize(); if(sqlite3_create_function(db_handle, "distance", 4, SQLITE_ANY, 0, &distanceFunc, 0, 0)) { qCritical() << "Cannot create SQLite functions: sqlite3_create_function failed."; return false; } return true; } qCritical() << "Cannot get a sqlite3 handle to the driver."; return false; }
code_text
including this file, sqlite3.pri in my .pro file appears to have solved my problem as the compiled program now runs in release mode as well as debug mode!
SOURCES += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.c HEADERS += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h win32:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)\\..\\Src\\qtbase\\src\\3rdparty\\sqlite\\sqlite3.h) $$shell_path($$PWD) $$escape_expand(\\n\\t) else:unix:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h) $$shell_quote($$PWD) $$escape_expand(\\n\\t) message($$QMAKE_POST_LINK) `` Now, to insure that the MacOS version has no problem with the change.
-
Enable the Debugger Log and have a look there after error messages.
-
Try again, the Debugger Log window looks like this:
That log contains all the details regarding the startup of the
cdb.exe
executable and there might be some logging regarding of the failure. -
Here is some detail from the log:
wNote: This log contains possibly confidential information about your machine, environment variables, in-memory data of the processes you are debugging, and more. It is never transferred over the internet by Qt Creator, and only stored to disk if you manually use the respective option from the context menu, or through mechanisms that are not under the control of Qt Creator's Debugger plugin, for instance in swap files, or other plugins you might use.
wYou may be asked to share the contents of this log when reporting bugs related to debugger operation. In this case, make sure your submission does not contain data you do not want to or you are not allowed to share.
w
sQML Debugger: Status of "QmlDebugger" Version: -1 changed to 'not connected'.
dState changed from DebuggerNotReady(0) to EngineSetupRequested(1)
dCALL: SETUP ENGINE
dNOTE: ENGINE SETUP OK
dState changed from EngineSetupRequested(1) to EngineRunRequested(3)
dCALL: RUN ENGINE
sQML Debugger: Trying to connect ...
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingState
sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingStatewNote: This log contains possibly confidential information about your machine, environment variables, in-memory data of the processes you are debugging, and more. It is never transferred over the internet by Qt Creator, and only stored to disk if you manually use the respective option from the context menu, or through mechanisms that are not under the control of Qt Creator's Debugger plugin, for instance in swap files, or other plugins you might use.
wYou may be asked to share the contents of this log when reporting bugs related to debugger operation. In this case, make sure your submission does not contain data you do not want to or you are not allowed to share.
w
dStart parameters: 'mapper_app' mode: 1
dABI: x86-windows-msvc2022-pe-64bit
dLanguages: c++ qml
dExecutable: C:\Users\allen\Projects\Mapper\build-mapper-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\mapper_app\debug\mapper.exe "-qmljsdebugger=port:49893,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation"
dDirectory: C:\Users\allen\Projects\Mapper\mapper_QT\mapper_app
dDebugger: C:\Program Files\Windows Kits\10\Debuggers\x64\cdb.exe
dProject: C:\Users\allen\Projects\Mapper\mapper_QT
dAdditional Search Directories:
dQML server: 127.0.0.1:49893
dSysroot:
dDebug Source Location: /usr/src/debug/qt5base/src/corelib:/usr/src/debug/qt5base/src/gui:/usr/src/debug/qt5base/src/network
dStart parameters: 'mapper_app' mode: 1
dABI: x86-windows-msvc2022-pe-64bit
dLanguages: c++ qml
dExecutable: C:\Users\allen\Projects\Mapper\build-mapper-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\mapper_app\debug\mapper.exe "-qmljsdebugger=port:49893,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation"
dDirectory: C:\Users\allen\Projects\Mapper\mapper_QT\mapper_app
dDebugger: C:\Program Files\Windows Kits\10\Debuggers\x64\cdb.exe
dProject: C:\Users\allen\Projects\Mapper\mapper_QT
dAdditional Search Directories:
dQML server: 127.0.0.1:49893
dSysroot:
dDebug Source Location: /usr/src/debug/qt5base/src/corelib:/usr/src/debug/qt5base/src/gui:/usr/src/debug/qt5base/src/network
dDebugger settings:
d/AdditionalArguments: (default: )
d/AlwaysAdjustColumnWidths: true (default: true)
d/AutoDerefPointers: true (default: true)
d/BreakEvent: (default: )
d/BreakOnCrtDbgReport: false (default: false)
d/BreakpointCorrection: true (default: true)
d/CDB_Console: false (default: false)
d/FirstChanceExceptionTaskEntry: true (default: true)
d/IgnoreFirstChanceAccessViolation: false (default: false)
d/LogTimeStamps: false (default: false)
d/SecondChanceExceptionTaskEntry: true (default: true)
d/SortStructMembers: true (default: true)
d/SourcePaths: (default: )
d/SymbolPaths: (default: )
d/UsePythonDumper: true (default: true)
d/UseToolTipsInBreakpointsView: false (default: false)
d/UseToolTipsInLocalsView: false (default: false)
d/UseToolTipsInStackView: true (default: true)
dDebugger settings:
d/AdditionalArguments: (default: )
d/AlwaysAdjustColumnWidths: true (default: true)
d/AutoDerefPointers: true (default: true)
d/BreakEvent: (default: )
d/BreakOnCrtDbgReport: false (default: false)
d/BreakpointCorrection: true (default: true)
d/CDB_Console: false (default: false)
d/FirstChanceExceptionTaskEntry: true (default: true)
d/IgnoreFirstChanceAccessViolation: false (default: false)
d/LogTimeStamps: false (default: false)
d/SecondChanceExceptionTaskEntry: true (default: true)
d/SortStructMembers: true (default: true)
d/SourcePaths: (default: )
d/SymbolPaths: (default: )
d/UsePythonDumper: true (default: true)
d/UseToolTipsInBreakpointsView: false (default: false)
d/UseToolTipsInLocalsView: false (default: false)
d/UseToolTipsInStackView: true (default: true)
dState changed from DebuggerNotReady(0) to EngineSetupRequested(1)
dCALL: SETUP ENGINE
Launching C:\Program Files\Windows Kits\10\Debuggers\x64\cdb.exe -aqtcreatorcdbext.dll -lines -G -c ".idle_cmd !qtcreatorcdbext.idle" -y ""^"""^""" C:\Users\allen\Projects\Mapper\build-mapper-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\mapper_app\debug\mapper.exe "-qmljsdebugger=port:49893,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation"
using C:\Qt\Tools\QtCreator\lib\qtcreatorcdbext64\qtcreatorcdbext.dll of 12/10/2023 8:12 PM.
C:\Program Files\Windows Kits\10\Debuggers\x64\cdb.exe running as 9332
Microsoft (R) Windows Debugger Version 10.0.17763.132 AMD64
Using CDB based breakpoint correction.
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: C:\Users\allen\Projects\Mapper\build-mapper-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\mapper_app\debug\mapper.exe "-qmljsdebugger=port:49893,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation"Error: Change all symbol paths attempts to access '""' failed: 0x7b - The filename, directory name, or volume label syntax is incorrect.
************* Path validation summary **************
Response Time (ms) Location
Error ""
Symbol search path is: ""
Executable search path is:
Module loaded: mapper.exe
Module loaded: ntdll.dll
Module loaded: C:\WINDOWS\System32\KERNEL32.DLL
Module loaded: C:\WINDOWS\System32\KERNELBASE.dll
Module loaded: C:\WINDOWS\System32\SHELL32.dll
Module loaded: C:\WINDOWS\System32\msvcp_win.dll
Module loaded: C:\WINDOWS\System32\ucrtbase.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5WebEngineWidgetsd.dll
Module loaded: C:\WINDOWS\System32\USER32.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Widgetsd.dll
Module loaded: C:\WINDOWS\System32\win32u.dll
Module loaded: C:\WINDOWS\System32\GDI32.dll
Module loaded: C:\WINDOWS\System32\gdi32full.dll
Module loaded: C:\WINDOWS\System32\ole32.dll
Module loaded: C:\WINDOWS\System32\RPCRT4.dll
Module loaded: C:\WINDOWS\System32\combase.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5WebSocketsd.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5WebChanneld.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Networkd.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Sqld.dll
Module loaded: C:\WINDOWS\System32\CRYPT32.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Xmld.dll
Module loaded: C:\WINDOWS\System32\ADVAPI32.dll
Module loaded: C:\WINDOWS\System32\msvcrt.dll
Module loaded: C:\WINDOWS\System32\sechost.dll
Module loaded: C:\WINDOWS\System32\bcrypt.dll
Module loaded: C:\WINDOWS\SYSTEM32\VCRUNTIME140_1D.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll
Module loaded: C:\WINDOWS\System32\WS2_32.dll
Module loaded: C:\WINDOWS\SYSTEM32\VCRUNTIME140D.dll
Module loaded: C:\WINDOWS\SYSTEM32\ucrtbased.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Quickd.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5PrintSupportd.dll
Module loaded: C:\WINDOWS\System32\COMDLG32.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5WebEngineCored.dll
Module loaded: C:\WINDOWS\System32\shcore.dll
Module loaded: C:\WINDOWS\System32\SHLWAPI.dll
Module loaded: C:\WINDOWS\System32\OLEAUT32.dll
Module loaded: C:\WINDOWS\SYSTEM32\UxTheme.dll
Module loaded: C:\WINDOWS\SYSTEM32\dwmapi.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5QuickWidgetsd.dll
Module loaded: C:\WINDOWS\SYSTEM32\MSVCP140D.dll
Module loaded: C:\WINDOWS\SYSTEM32\MSVCP140_1D.dll
Module loaded: C:\WINDOWS\SYSTEM32\d3d11.dll
Module loaded: C:\WINDOWS\SYSTEM32\dxgi.dll
Module loaded: C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL
Module loaded: C:\WINDOWS\SYSTEM32\DNSAPI.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Qmld.dll
Module loaded: C:\WINDOWS\SYSTEM32\MPR.dll
Module loaded: C:\WINDOWS\SYSTEM32\VERSION.dll
Module loaded: C:\WINDOWS\SYSTEM32\USERENV.dll
Module loaded: C:\WINDOWS\SYSTEM32\NETAPI32.dll
Module loaded: C:\WINDOWS\SYSTEM32\WINMM.dll
Module loaded: C:\WINDOWS\SYSTEM32\WINSPOOL.DRV
Module loaded: C:\WINDOWS\SYSTEM32\dbghelp.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Positioningd.dll
Module loaded: C:\Qt\5.15.2\msvc2019_64\bin\Qt5QmlModelsd.dll
Module loaded: C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.3636_none_60b6a03d71f818d5\COMCTL32.dll
Module loaded: C:\WINDOWS\SYSTEM32\ncrypt.dll
Module loaded: C:\WINDOWS\SYSTEM32\WINHTTP.dll
Module loaded: C:\WINDOWS\SYSTEM32\Secur32.dll
Module loaded: C:\WINDOWS\SYSTEM32\DWrite.dll
Module loaded: C:\WINDOWS\SYSTEM32\WTSAPI32.dll
Module loaded: C:\WINDOWS\SYSTEM32\d3d9.dll
Module loaded: C:\WINDOWS\SYSTEM32\dxva2.dll
Module loaded: C:\WINDOWS\SYSTEM32\USP10.dll
Module loaded: C:\WINDOWS\SYSTEM32\HID.DLL
Module loaded: C:\WINDOWS\SYSTEM32\urlmon.dll
Module loaded: C:\WINDOWS\SYSTEM32\dhcpcsvc.DLL
Module loaded: C:\WINDOWS\SYSTEM32\FONTSUB.dll
Module loaded: C:\Users\allen\Projects\Mapper\build-mapper-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug\mapper_app\debug\sqlite3.dll
Module loaded: C:\WINDOWS\SYSTEM32\kernel.appcore.dll
Module loaded: C:\WINDOWS\SYSTEM32\windows.storage.dll
Module loaded: C:\WINDOWS\SYSTEM32\srvcli.dll
Module loaded: C:\WINDOWS\SYSTEM32\iertutil.dll
Module loaded: C:\WINDOWS\SYSTEM32\netutils.dll
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\atlmfc.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\concurrency.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\cpp_rest.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\stl.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\Windows.Data.Json.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\Windows.Devices.Geolocation.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\Windows.Devices.Sensors.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\Windows.Media.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\windows.natvis'
NatVis script unloaded from 'C:\Program Files\Windows Kits\10\Debuggers\x64\Visualizers\winrt.natvis'
eERROR: Process crashed
dCDB PROCESS FINISHED, status 1, exit code -1073741701 (0x-3fffff85)
dNOTE: INFERIOR ILL
dState changed from EngineSetupRequested(1) to InferiorShutdownRequested(12)
dCALL: SHUTDOWN INFERIOR
dINFERIOR FINISHED SHUT DOWN
dState changed from InferiorShutdownRequested(12) to InferiorShutdownFinished(13)
dState changed from InferiorShutdownFinished(13) to EngineShutdownRequested(14)
dCALL: SHUTDOWN ENGINE
dNOTE: ENGINE SHUTDOWN FINISHED
dState changed from EngineShutdownRequested(14) to EngineShutdownFinished(15)
Debugger finished.
dState changed from EngineShutdownFinished(15) to DebuggerFinished(16)sQML Debugger: Socket state changed to QAbstractSocket::HostLookupState
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingStatesQML Debugger: Socket state changed to QAbstractSocket::HostLookupState
sQML Debugger: Socket state changed to QAbstractSocket::ConnectingStatesQML Debugger: Socket state changed to QAbstractSocket::HostLo
-
Does the project use QtWebEngine? If not, please remove the component from the installation.
QtWebEngine is huge and might be the cause of the crash.
-
Yes, the project definitely uses the web engine. The app displays transit routes on Google Maps in a webengine view or a browser window. The source is on github: Mapper
I thought earlier today that size might be pat of the problem, particularly since several sqlite database files are included as qrc resources but removing them made no difference.
I normally use Ubuntu but wish to share the progam so I have to know port it to Windows and MacOS. Mac OS is the reason why those files are included as qrc resources as it simplifies creating an installer for the MacOS port. There may be a better way to install the databases on MacOS but I haven't wanted to spend the time to research how to do it. I have never used Apple computes so I am a complete newbie there.
Up until a few days ago, I had no problems with Windows and posted a windows installer for a friend which you can download here.
-
If the debugger crashes ... sucks.
You could try https://download.qt.io/snapshots/qtcreator/13.0/13.0.0-beta1/
There we bundle
lldb.exe
, which should be able to debug MSVC projects.I don't know if it fares better.
We plan to offer this as an alternative to cdb.
-
@cristian-adam I don't know if the beta version of Qt Creator would help. Maybe you missed the fact that the program won't run in non debug mode either. I will give it a try.
-
-
The program compiles and links ok but will not run
Aaah. I was thinking was about the crashing in debug mode.
See this thread https://forum.qt.io/post/769276 for information about how to debug a Qt application that doesn't start.
In this case was Qt Creator, but you can adapt to your case.
-
You could also enable mini dump crash files for Windows, see https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
Then load the said
dmp
file into Qt Creator usinglldb.exe
from Qt Creator 13. See https://bugreports.qt.io/browse/QTCREATORBUG-29423 for more details. -
@cristian-adam I took a look at what was required to build Qt Creator from source an it appeared to be rather involved with the need to install LLVM and other prerequisites so I decided to wait until I was fresh. I'll give it a try later this morning.
In the meantime, I am investigating whether the problem involves some code I have to create a Sqlite3 User Defined Procedure. In order to do this, I need to include sqlite3.c and sqlite3.h in the program. The problem may be a discrepancy between the version of Sqlite3 in the Qt distribution and what I am compiling with. In qmake (my .pro file), I can say:
SOURCES += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.c HEADERS += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h
but I'm trying to figure out where I have
include "sqlite3.h"
in my .cpp file to include the correct version . Maybe I can create a define in the .pro file to do this?
Anyway, thanks for your continued attention and help.
-
You don't need to build Qt Creator in order to debug why your application doesn't start.
You can do the following things to find out what's going on with mapper.exe.
Getting access to the Qt logs
- Set the environment variable
QT_LOGGING_RULES=qt*=true
- Start DebugView to capture the debug log messages
- Start mapper.exe
Hopefully something will pop up in the DebugView
Errors reported by the operating system
In the Windows "Event Viewer" application in the "Windows Logs" category usually the "Application" and "System" contain traces that might help pinpoint the failure
Taking mapper.exe startup under the magnifying glass
Using Process Monitor and filtering after
mapper.exe
you can find out all the file access, registry access and so forth.Good luck finding the root cause.
- Set the environment variable
-
@cristian-adam As I reported earlier, I believed the problem had to do with the code that uses sqlite3_create_function to create a sqlit3 function which means that my cpp file needs to include "sqlite3.h". Furthermore, this file needs to be the same as that used in the particular Qt version.
Here is my code to do this:
void distanceFunc(sqlite3_context* ctx, int argc, sqlite3_value **argv) { double Lat1, Lon1, Lat2, Lon2; Lat1 = sqlite3_value_double(argv[0]); Lon1 = sqlite3_value_double(argv[1]); Lat2 = sqlite3_value_double(argv[2]); Lon2 = sqlite3_value_double(argv[3]); // sqlite3_result_value(distance(LatLng(a1,a2),LatLng(a3,a4))); if (Lat1 == Lat2 && Lon1 == Lon2) sqlite3_result_double(ctx,0); double R = 6371; // RADIUS OF THE EARTH IN KM double dToRad = 0.0174532925; double lat1 = Lat1 * dToRad; //double lon1 = Lon1 * dToRad; double lat2 = Lat2 * dToRad; //double lon2 = Lon2 * dToRad; double dLat = dToRad * (Lat2 - Lat1); double dLon = dToRad * (Lon2 - Lon1); double a = qSin(dLat / 2) * qSin(dLat / 2) + qCos(lat1) * qCos(lat2) * qSin(dLon / 2) * qSin(dLon / 2); double c = 2 * qAtan2(qSqrt(a), qSqrt(1 - a)); double d = R * c; sqlite3_result_double(ctx,d); // distance in kilometers } bool SQL::loadSqlite3Functions(QSqlDatabase db) { QVariant v = db.driver()->handle(); sqlite3 *db_handle = NULL; if (v.isValid() && strcmp(v.typeName(), "sqlite3*") == 0) { // v.data() returns a pointer to the handle db_handle = *static_cast<sqlite3 **>(v.data()); if (!db_handle) { qCritical() <<"Cannot get a sqlite3 handler."; return false; } sqlite3_initialize(); if(sqlite3_create_function(db_handle, "distance", 4, SQLITE_ANY, 0, &distanceFunc, 0, 0)) { qCritical() << "Cannot create SQLite functions: sqlite3_create_function failed."; return false; } return true; } qCritical() << "Cannot get a sqlite3 handle to the driver."; return false; }
code_text
including this file, sqlite3.pri in my .pro file appears to have solved my problem as the compiled program now runs in release mode as well as debug mode!
SOURCES += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.c HEADERS += $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h win32:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)\\..\\Src\\qtbase\\src\\3rdparty\\sqlite\\sqlite3.h) $$shell_path($$PWD) $$escape_expand(\\n\\t) else:unix:QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote( $$(QTDIR)/../Src/qtbase/src/3rdparty/sqlite/sqlite3.h) $$shell_quote($$PWD) $$escape_expand(\\n\\t) message($$QMAKE_POST_LINK) `` Now, to insure that the MacOS version has no problem with the change.
-