How to add compiler include paths and linker library paths for newly installed Boost?

前端 未结 4 956
礼貌的吻别
礼貌的吻别 2020-12-14 08:26

I have RHEL 5.2, with Boost 1.33 installed. I downloaded boost_1_44_0.tar.bz2. and built it. On completion it showed:

The Boost C++ Libraries were successful         


        
相关标签:
4条回答
  • 2020-12-14 08:42

    There are always three steps to install software on Linux systems:

    1. configure — "check"
    2. make — "build software in current directory"
    3. make install — "copy files to the systems so the other software can use this software"

    You likely did the equivalent of make but did not do the equivalent of make install. You need to run

    sudo ./b2 install
    

    after running ./b2

    0 讨论(0)
  • 2020-12-14 08:54

    Just add the paths to your .bashrc or .profile (or whatever floats your boat) like this:

    export LIBS="-L/home/dfe/Archive/boost_1_44_0/stage/lib"
    export CPPFLAGS="-I/home/dfe/Archive/boost_1_44_0"
    
    0 讨论(0)
  • 2020-12-14 08:59

    You have to include these directories into makefile which you would use to build your application

    CC -I/home/dfe/Archive/boost_1_44_0 -L/home/dfe/Archive/boost_1_44_0/stage/lib yourprogram.cpp
    

    -I option Adds dir to the list of directories that are searched for #include files.

    -L option adds dir to the list of directories searched for libraries by linker

    CC is sun compiler...

    0 讨论(0)
  • 2020-12-14 09:01

    First, I removed the existing boost rpm using

    rpm -e boost-1.33.1-10.el5
    

    A message is displayed saying "error: "boost" specifies multiple packages"

    Then tried:

    rpm -e --allmatches boost
    

    (I don't remember whether I typed 'boost' or 'boost-1.33.1-10.el5')

    The packages with dependencies were shown. I did:

    rpm -e [packagename1]
    rpm -e [packagename2]
    

    and so on and then did:

    rpm -e --allmatches
    

    This erased boost completely from my system.

    Then I extracted boost_1_44_0.tar.bz2 using tar -xvjf boost_1_44_0.tar.bz2 and ran bootstrap with:

    ./bootstrap.sh
    

    Then ran bjam as:

    ./bjam install
    

    That's it! Boost got installed on my system, and I didn't have to specify any of the linker options while compiling programs! Yay! Now the 'rpm -q boost' command shows that there is no package installed.

    0 讨论(0)
提交回复
热议问题