Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install boost under Linux

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install boost under Linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Boost library is a well-honed, portable, source code C++ library, as the backup of the standard library, is one of the engines of C++ standardization process.

I. installation method

When installing boost, it is actually very simple, follow these steps to install it:

Wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gztar-xzvf boost_1_54_0.tar.gzcd boost_1_54_0./bootstrap.sh-- prefix=/usr/local./b2 install-- with=allboost library is installed under / usr/local/lib II. Compilation error

If you compile an application with a boost library, such as running the command on the terminal: Gmail + syslogem.cpp-lboost_system

If the following error occurs

Undefined reference to `boost::system::generic_category () 'undefined reference to `boost::system::generic_category ()' undefined reference to `boost::system::system_category ()'

Have to add a path

Gmail + syslogem.cpp-L/usr/local/lib-lboost_system

The solution on Linux's eclipse platform is to add a "/ usr/local/lib" path.

The boost installation method of Linux platform the boost installation method of Linux platform 3. Running error

If the following error occurs during the run phase

Error while loading shared libraries: libboost_system.so.1.54.0: cannot open shared object file: No such file or directory

The following solutions can be made:

1) add environment variable: LD_LIBRARY_PATH=/usr/local/lib

The way to add in eclipse is to click: run / run configuration / Environment / New. Then add the above variables and variable values, as shown below.

Boost installation method of Linux platform boost installation method of Linux platform

Note:

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

2) add links manually: ln-s / usr/local/lib/libboost_system.so.1.54.0 / lib64

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

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 are created to manage a large number of files. However, this makes the references in the project very complex, so you can add automatic search paths to the project to solve the problem of complex references. As follows:

Right-click on the project and select Properties; Select: C _ GNC accounts + build à Settings à C++ compiler à include; in the previous section, add a path; click on the workspace to add the directory you want to search.

The above is all the contents of the article "how to install boost under Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report