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:
- wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz
- TAR-XZVF boost_1_54_0.tar.gz
- CD Boost_1_54_0
- ./bootstrap.sh--prefix=/usr/local
- ./B2 Install--with=all
- 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
- Undefined reference to ' boost::system::generic_category () '
- Undefined reference to ' boost::system::generic_category () '
- Undefined reference to ' boost::system::system_category () '
Had to add a path
- 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
- 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:
- Right-click the project and select Properties ;
- Select:c/C + + build à set àGNC c + + compiler à contains ;
- In the previous section, add the path;
- Click Workspaces to add the directories you want to search.
Full solution for boost installation of Linux platforms