The compilation and Installation Process of fltk in Linux allows you to avoid detours.

Source: Internet
Author: User

It took a whole day to install fltk in Linux. I spoke very well about fltk2.0 on the Internet, so I downloaded it.Fltk-2.0.x-alpha-r9296.tar.bz2. Then I started compiling. Open readme. UNIX. Go to the following:

...
You can get the exact setup you need. options that you can pass
./Configure include:

-- Disable-xft-don't use xft/xrender (Anti-aliased fonts)
-- Enable-debug-enable debugging code & symbols
-- Enable-shared-enable generation of shared libraries

-- Prefix =/Dir-set the directory prefix for files
[Default =/usr/local]
-- Bindir =/path-set the location for executables
[Default =/usr/local/bin]
-- Libdir =/path-set the location for libraries
[Default =/usr/local/lib]
-- Export dedir =/path-set the location for include files.
[Default =/usr/local/include]

To install the library, become root and type "make install". This
Will copy the "fluid" executable to "bindir", the header files
"Includedir"/fltk, and the library files to "libdir ".
...

You can understand this in English and have installed software in Linux.

As a result, I will extract the following:

$ Tar xvf fltk-2.0.x-alpha-r9296.tar.bz2

Then configure

$./Configure -- disable-xft -- enable-Debug -- enable-shared

A few minutes later, make

$ Make

Make has an error in the middle. The problem is that some files are missing in the fltk/Gl/folder. Then I took a lot of detours. The result still ends with a failure. The following describes the key points.

There will always be some problems according to the above operations. I have found a lot of information, and I have helped me with this information (install fltk in Ubuntu. Although the version is 1.x, the installation is similar in Linux. I also recommend that you installCodeLibrary, try to set the directory of the library file.

Here, I created the following directory to store the fltk library.

$ Mkdir/home/hanxi/reference/fltk2

$ CD/home/hanxi/reference/fltk2

$ Mkdir {bin, Lib, include}

After setting the directory for the library, I can install it first.Source codeDirectory, and then execute the following statement for configure

$. /Configure -- enable-Debug -- disable-gl -- enable-shared -- enable-threads -- enable-xdbe -- enable-xft -- bindir =/home/hanxi/reference/fltk2/bin -- libdir =/home/hanxi/reference/fltk2/lib -- includedir =/home/hanxi/reference/fltk2/include -- prefix =/home/hanxi/reference/fltk2

It is important to note that the following path should not be written incorrectly. Then execute the Mak statement. Note that there will still be an error in the missing files in the GL directory. So use the following command

$ Make-ki

After a few minutes, execute make install

$ Make install

By now, the installation is successful. Let's give an example:

Test code:

# Include <fltk/window. h> # Include <Fltk/widget. h> # Include <Fltk/run. h> Using   Namespace Fltk;  Int Main ( Int Argc, Char ** Argv) {window * Window = New Window ( 800 , 600  ); Window -> Begin (); widget * Box = New Widget ( 20 , 40 ,260 , 100 , "  Hello, world!  "  ); Box -> Box (up_box); Box -> Labelfont (helvetica_bold_italic); Box -> Labelsize ( 36  ); Box -> Labeltype (shadow_label); window -> End (); window ->Show (argc, argv); run ();  Return   1  ;} 

MAKEFILE file:

 
Test: Test. cpp g++ Test. CPP-O test-I/home/hanxi/reference/fltk2/include-L/home/hanxi/reference/fltk2/lib-lfltk2-lxext-lxinerama-lxft-lx11-LXI-Lmclean: Rm*. O

Running effect:

Note: In China, there are still few tutorials for installing things in Linux. However, if you have learned to read the help documentation, this is not a problem at all. Thank you for seeing this and hope you will have some benefits.

References:

[1] install fltk in Ubuntu

[2] Write makefile with me (1)

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.