Full solution for boost installation of Linux platforms

Source: Internet
Author: User

Recently put the CPP code from the development machine to the compiler, encountered a lot of path problems, so the document.

First, installation method

When installing boost, it's actually quite simple to install as follows:

    1. wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz
    2. TAR-XZVF boost_1_54_0.tar.gz
    3. CD Boost_1_54_0
    4. ./bootstrap.sh--prefix=/usr/local
    5. ./B2 Install--with=all
    6. Boost Library is installed under/usr/local/lib

Second, compile error

If you compile an application with the boost library, such as running the command at the terminal: g++ Syslogem.cpp-lboost_system

If the following error occurs

    1. Undefined reference to ' boost::system::generic_category () '
    2. Undefined reference to ' boost::system::generic_category () '
    3. Undefined reference to ' boost::system::system_category () '

Had to add a path

    1. g++ Syslogem.cpp-l/usr/local/lib-lboost_system

The solution to the Linux Eclipse platform is to add a "/usr/local/lib" path.

Third, run error

If the following error occurs during the re-run phase

    1. Error while loading shared libraries:libboost_system.so.1.54.0:cannot open shared object File:no such File or directory

The following can be resolved:

1) Add environment variable: ld_library_path=/usr/local/lib

The way to add Eclipse is to click: Run/Run Configuration/environment/new. Then add the above variables and variable values as shown below.

Attention:

If you want to execute the command on the terminal, you need to export to the ~/.bash_profile file. Of course, if you add the boot file, you don't need to configure it in Eclipse.

2) Manually add the link:ln-s/usr/local/lib/libboost_system.so.1.54.0/lib64

This needs to be done on the Linux terminal, regardless of whether the Eclipse platform is used or not.

Iv. Eclipse file Directory Management

Because there are many files in the C + + project, in order to facilitate the management of these files, some folders have been created to manage a large number of files. However, this results in a very complex reference in your project, allowing you to add an automatic search path to your project to solve the problem of complex references. As shown below:

    1. Right-click the project and select Properties ;
    2. Select:c/C + + build à set àGNC c + + compiler à contains ;
    3. In the previous section, add the path;
    4. Click Workspaces to add the directories you want to search.

Full solution for boost installation of Linux platforms

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.