新手求助:在CodeLite中配置使用已安装的Boost库
Hey there! Glad to hear you’ve successfully installed Boost to /usr/local/boost_1_67_0 and got the sample program running. Now let’s get it set up in CodeLite so you can start using Boost in your own projects smoothly. Here’s how to do it:
Option 1: Global Configuration (Applies to All Projects)
If you want every CodeLite project to have access to Boost, set this up once:
- Open CodeLite, go to the top menu bar and click
Settings>Compiler - Select your active compiler (like GCC) from the left sidebar
- Switch to the Include Paths tab, click
Add, paste/usr/local/boost_1_67_0, then save - Next, go to the Libraries Paths tab, add
/usr/local/boost_1_67_0/stage/lib(this is where your compiled Boost libraries live after the full install) - If you need to link specific Boost libraries (e.g.,
boost_filesystem,boost_thread), head to the Linker tab, add the library names to theLibrarieslist (omit thelibprefix and.sosuffix, so justboost_filesystemforlibboost_filesystem.so)
Option 2: Project-Specific Configuration (Only for One Project)
If you only want Boost available for a single project:
- Right-click your project in the workspace panel, select
Settings - Under
Compiler>Include Paths, add/usr/local/boost_1_67_0 - Under
Linker>Libraries Paths, add/usr/local/boost_1_67_0/stage/lib - Under
Linker>Libraries, add the specific Boost libraries you plan to use
Test Your Setup
To make sure everything’s working, create a quick test code:
#include <iostream> #include <boost/version.hpp> int main() { std::cout << "Boost Version: " << BOOST_VERSION << "\n"; return 0; }
Compile and run it—if it outputs 106700 (the version code for 1.67.0), you’re all set!
Quick reminder: The message you got after running
./bootstrap.shis exactly pointing out the paths we’ve added above, so you’re following the official guidance perfectly.
内容的提问来源于stack exchange,提问作者infinitezero

