Qt5.8 build an OCI-driven tutorial for Oracle databases

Source: Internet
Author: User

I have already sent a similar article in the previous article, please click here: QT5 compiling the Oracle driver tutorial.

The common version of Oracle database-driven support for QT5 has been addressed in that article, but it has been invalidated in the new QT development tool, specifically in the version after Qt5.7.1.

This time I brought Qt5.8.0 's compilation tutorial, theQt5.9 version also applies.

Qt version is Qt5.8.0, the installation path is the default C:\Qt\Qt5.8.0, Oracle client version Oracle 11g installation path is d:\ App\xiao\product\11.2.0\client_1.

Open The oci.pro below the C:\Qt\Qt5.8.0\5.8\Src\qtbase\src\plugins\sqldrivers\oci directory .

Results of direct compilation without modification: Library ' OCI ' is not defined.

,

There is an online tutorial about qt5.8 + vs2015 compiling qoci drive Project error:library ' OCI ' is not defined, but unlike what I used, I used the MinGW version. Therefore, I cannot use his method. If you are using VS to compile the can go to his side to see, become and not I have not tried.

use VC to compile the files in the source file. Qmake_use + = OCI instead of qmake_lflags +=oci.lib, use GCC to compile to qmake_lflags +=oci.dll, because I am using the MinGW version so mine is Qmake_lflags +=oci.dll. Note: qmake_lflags means specifying the path of a dependent library.

Result of the modified compilation: Oci.dll:No such file or directory, no such files or directories

The reason for this is simple because the Oracle database you installed did not add the path of the corresponding bin directory to path

On the top of the graph is my bin path. At this time you will say that my inside also added, software installed when you added and so on ...

Here is a statement of why to add path, because Qmake_lflags +=oci.dll, he loaded "oci.dll" in that Bin directory, now you all understand it!

And the reason we're wrong here is, QT, he didn't find your path, so we just added it in the simplest and most brutal way possible.

Qmake_lflags + =D:\app\Xiao\product\11.2.0\client_1\BIN\oci.dll, note: The accents section is the BIN directory location of the Oracle database you installed.

Go to here, a lot of people still can't compile success, hey ... Here's what I want to remind you that if you read a similar article, you shouldn't forget to add

Includepath + = D:\app\Xiao\product\11.2.0\client_1\oci\include

LIBPATH + = D:\app\Xiao\product\11.2.0\client_1\oci\lib\msvc

Then recompile, you will find that the compilation passed, at this time we in the root directory of QT installation to find ": \plugins" will find inside a "sqldrivers" folder, copy it to Qt . \qt\qt5.8.0\5.8\mingw53_32\plugins below.

Well, it's over, and to summarize is the need to:

1, modify: The original qmake_use + = OCI changed to qmake_lflags + =D:\app\Xiao\product\11.2.0\client_1\BIN\ Oci.dll.

2. Add: Includepath + = D:\app\Xiao\product\11.2.0\client_1\oci\include

LIBPATH + = D:\app\Xiao\product\11.2.0\client_1\oci\lib\msvc

3. Compile: Build → rebuild project "OCI"

4, copy: Will : \plugins The following "Sqldrivers" folder copied to Qt . \qt\qt5.8.0\5.8\mingw53_32\plugins below.

Qt5.8 build an OCI-driven tutorial for Oracle databases

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.