Build the compiling and debugging environment for Linux Redhat 9 qt4

Source: Internet
Author: User
Tags parse error

Linux Redhat 9 unzip ", download it to Linux and decompress it. In XWindow, right-click" Unzip ..", Haha, I am too lazy to think about the annoying commands in Linux. Before that, you 'd better do some work first, or the compilation below will go wrong.

Open a terminal and enter:

  1. Ln-S/usr/Kerberos/include/com_err.h/usr/include/
  2. Ln-S/usr/Kerberos/include/profile. h/usr/include/
  3. Ln-S/usr/Kerberos/include/krb5.h/usr/include/

It is set in this system. Otherwise, an error about "krb5.h" will be reported during compilation.

For other QT versions, for example, “qt-x11-opensource-src-4.4.3.tar.gz ", you also need to modify some files in it. It will report an error" 'readrgbaimageoriented' undeclared ". The modification method is to open qinihandler. CPP transfers the encoded readrgbaimageoriented (TIFF, width, height, reinterpret_cast <uint32 *> (partial image. BITs (), orientation_topleft, 0)
When readrgbaimage (TIFF, width, height, reinterpret_cast <uint32 *> (when image. BITs (), 0), because usr/include/Rewrite IO in RedHat 9. h does not have the previous function.

Compile and install oracle at the beginning. Just wait.

In the terminal, CD to the decompressed file, and then enter:

  1. ./Configure
  2. Gmake
  3. Gmake install

The entire process takes more than two hours.

After the installation, the following interface appears, right, It installs the default path is:/usr/local/trolltech/Under the Qt-4.3.4

Configure the environment variables of qt4 as follows:

  1. // Open the/etc/profile file and add the following statement at the end of the file:
  2. Path =/usr/local/trolltech/Qt-4.3.4/bin: $ path
  3. Qtdir =/usr/local/trolltech/Qt-4.3.4
  4. Manpath = $ qtdir/MAN: $ manpath
  5. LD_LIBRARY_PATH = $ qtdir/lib: $ LD_LIBRARY_PATH
  6. Export path qtdir manpath LD_LIBRARY_PATH

Qt3 is enabled by default. Now let's modify the associated file that starts qt3 under "/usr/bin" and find "designer ", we found that this file really links the execution file of qt3. It is clear that the designer is a link and points to the designer of qt3 through the designer. Now we want the designer to be the designer of qt4 by default, you only need to redirect the link. Similarly, if you want qmake to use qt4 by default, you only need to redirect the link.

  1. Sudo RM/usr/bin/designer
  2. Sudo ln-S/usr/local/trolltech/Qt-4.3.4/bin/DESIGNER/usr/bin/designer
  3. Sudo RM/usr/bin/qmake
  4. Sudo ln-S/usr/local/trolltech/Qt-4.3.4/bin/qmake/usr/bin/qmake

I suggest you change the link to the execution file under "/usr/local/trolltech/Qt-4.3.4. In this way, you can thoroughly use qt4.

The default font of qt4 will contain garbled characters. Let's set it. Open qtconfig and select "forts". The other settings remain unchanged.


Open qdesigner to display our long-awaited qt4 Interface

Next we will install and debug the compilation environment. Here we will not select the kdevelop series. I think it is quite annoying to install it. The first redhat9 comes with QT 3.1.1, to install kdevelop3.5 (you can debug the qt4 Program), you must upgrade the QT version of the system to version 3.3, which is not exhausting, so here I will use the lightweight qdevelop0.26. The reason why I say it is lightweight is that it is "installed" (only need to compile (it must be qt4.3.x) and then use its execution file) time is short.

Download “qdevelop-0.25.2.tar.gz "and decompress it. You only need qmake qdevelop. pro to make it again. This process takes about 10 minutes.

If the following error occurs during compilation:

  1. Src/initcompletion. cpp: In destructor 'virtual
  2. Initcompletion ::~ Initcompletion ()':
  3. Src/initcompletion. cpp: 52: Parse error before '+ 'token
  4. Src/initcompletion. cpp: 53: Confused by earlier errors, bailing out
  5. Make: *** [Build/O/Unix/initcompletion. O] Error 1

You only need to modify the initcompletion. cpp file in the src directory:

  1. // Original file
  2. Initcompletion ::~ Initcompletion ()
  3. {
  4. Qstringlist list = qdir (qdir: temppath (). entrylist (qstringlist () <"qdevelop-completion-*", qdir: files );
  5. Foreach (qstring file, list)
  6. {
  7. Qfile (qdir: temppath () + "/" + file). Remove ();
  8. }
  9. ........................
  10. }
  11. // Modify as follows:
  12. Initcompletion ::~ Initcompletion ()
  13. {
  14. Qstringlist list = qdir (qdir: temppath (). entrylist (qstringlist () <"qdevelop-completion-*", qdir: files );
  15. Foreach (qstring file, list)
  16. {
  17. Qstring STR = qdir: temppath () + "/";
  18. Qfile (STR + file). Remove ();
  19. }
  20. ........................
  21. }

After compilation, you can run and use it.

Let's create a new project, first feel:

The disadvantage of qdevelop is that it cannot display Chinese characters normally, so I had to write it elsewhere and paste it.

Compile and run:

Next we will give the program a home on the desktop:

In this way, it can be developed in windows. Increased development efficiency.

 

 

 

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.