Qt programming error - qt

I am developing Qt project. Previously I developed complete project that access database, but due to some reason i formatted the disk. When later on i run the project it showed me error for using QSqlDatabase QSqlError classes.
Please help me.

Perhaps something is missing in your Qmake project.

Related

How to generate compile_commands.json with QT project?

I'm not familiar with QT but have to work with a QT project(.pro) recently. I hope to generate a compile_commands.json for this project, so I can read codes inside emacs's lsp mode. Unfortunately, I cannot find any way.
Build/Generate Compilation Database for "yourprojectname"

Getting Link errors when crypto++ lib used in my MFC application

I am trying to encrypt some files using crypto++. I have found a useful article.
http://programmingknowledgeblog.blogspot.com/2013/04/compiling-and-integrating-crypto-into.html
I have created a sample project as in the tutorial. It works fine. Then I have tried to use the same in my MFC application. I have linked the cryptlib.lib correctly in project properties. But I am getting lot of LINK errors.
I have tried by changing the Runtime Library to Multi-threaded Debug (/MTd) and Use of MFC as Use MFC in a Shared DLL. Thanks in advance.

dependency qt.core not found for product

I get a lot of same errors when try to compile my project using qbs.
Like this:
Dependency "Qt.core" not found for product "dist".
Please create a Qt profile using the qbs-setup-qt tool if you haven't already done so.
Product 'dist' had errors and was disabled.
I use QtCreator. Should I "create a new Qt profile using the qbs-setup-qt tool"?
Please, can you explain what does it mean?
No, Qt Creator sets up the profiles automatically. The most common cause for this message is that the Kit you are using does not have a (valid) Qt version set. Please verify this first. If everything looks okay in that regard, please file an issue at bugreports.qt.io, and we will take it from there.

System.Data.SQLite in UNMANAGED C++

I want to use SQLite as a database for my C++ project. I also need the ability to password protect the database. I got the standard SQLite from SQLite.org working - but I need to password/encrypt the database and they don't do that - they just stub the interface for it to be done with
SQLITE_API int sqlite3_key( sqlite3 *db, const void *pKey, int nKey);
After researching on the web how to do this, I came across System.Data.SQLite. It claims to do all I need quite easily, but I need to do it from unmanaged C++ project in Visual Studio 2008. I tried their project - but I can't get my unmanaged C++ project to allow the DLL to work - it squawks about dll not being safe/clr:safe compile - which I can't set in the System.Data.SQLite project and compile.
Can anyone help me with this or point me to a good resource on how to do this? I have been thrown into a C++ project (hadn't touched C/C++ since college (97-98), so I am really struggling with this when it comes to the linker/libs/modules. Java and .NET have spoiled me!
Thanks,
Mike
You can't use a managed DLL from unmanaged code like that, they're different systems. Just use the normal unmanaged SQLite build and read the docs on how to use keys.
Recently, I've faced a similar problem like Mike and resolved it.
I would like to post my solution here in case anyone need.
I have two programs:
One is in C# to create encrypted sqlite database files using System.Data.SQLite.
The other one is in C++ to read the file created by the C# program.
After googling with no result, I looked at source code of System.Data.SQLite to figured out how System.Data.SQLite encrypts a database file.
I recognized that System.Data.SQLite uses SQLite.Interop.dll wrapping native sqlite with additional features such as encryption.
Therefore I used that native source code to build a static library. Then I use the library to read the encrypted database files.
You can find the source code at the following link:
https://github.com/OpenDataSpace/System.Data.SQLite/tree/master/SQLite.Interop/src
Update 2020/04/11
You can find a step by step guide at the following link:
https://wordpress.com/post/nguyenduyanhsite.wordpress.com/71

When using py2exe, PyQt application cannot load SQlite database

My PyQt application works fine when running on Linux, when in my Windows build environment, or frozen on the machine where it was build with py2exe. But after moving the frozen executable and its supporting files to another machine it can't load the database driver.
It worked fine when I had Python2.5 and an earlier version of PyQt and py2exe. But after upgrading my toolchain I get these errors:
dbname.open returns false
lastError(dbname) is "Driver not loaded"
I have an sqldrivers folder where I put qsqlite4.dll. This was necessary with the previous build environment, but moving or renaming that DLL doesn't change any behavior. I think that's the DLL that Qt can't find, but I haven't been able to tell Qt where to look.
I am currently running these versions:
python-2.6.3
PyQt-Py2.6-gpl-4.6-1
py2exe-0.6.9.win32-py2.6
Profiling in Dependency Walker gives me this error:
LoadLibraryW("\application\sqldrivers\qsqlite4.dll") returned NULL. Error: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
When I ask Dependency Walker for details about Qsqlite4.dll it says:
Error: The Side-by-Side configuration information for "\application\sqldrivers\QSQLITE4.DLL" contains errors.
That would explain why the DLL won't load, but I'm still unclear how to fix it. Closer inspection shows that error for most of the DLLs I call. Do I need to include a manifest for each Qt DLL I load?
Thanks in advance.
DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...
The accepted answer doesn't really say what dlls they copied and in what places. I managed to fix it by copying the driver inside the sqldrivers directory relative to where the exe and qt dlls are (I'm using PySide but should work with PyQt4 as well). In setup.py:
setup(
...,
data_files = [('sqldrivers', ('C:\Python27\Lib\site-packages\PySide\plugins\sqldrivers\qsqlite4.dll',))],
...,
)
I solved it!
I had a really clever way to avoid making my users install vcredist--I copied the manifest and the DLLs into two places and all the errors about the MS DLLs went away. That's when I started trying to figure out this SQLite driver error.
I wasn't as smart as I thought. If I install vcredist all the "Driver Not Loaded" and "No SQL drivers found" errors go away. Arg.
Try to re-install SOLite, or verify if you have putted the DLL in the correct place, because i remember that the MySQL DLL have to be in System32 directory to develop something that uses it.
Regards.

Resources