Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7844913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:03:09+00:00 2026-06-02T17:03:09+00:00

I was trying to install Boost on a linux machine(CentOs, Linux version 2.6.9-67.ELsmp). I

  • 0

I was trying to install Boost on a linux machine(CentOs, Linux version 2.6.9-67.ELsmp).
I followed with the instruction on Boost Getting Started webpage.
Downloaded and extracted the files, then I add prefix because I am not the root user.

./bootstrap.sh --prefix=/my_path/boost-1.49.0
./b2 install

I go to /my_path/boost-1.49.0 and check there are /include/boost/ and /lib/ contain files there.

also I set LD_LIBRARY_PATH to /my_path/boost-1.49.0/lib/.

To test if I installed successfully, I compile the following code:

main.cpp

#include <boost/regex.hpp>
#include <iostream>
#include <string>

using namespace boost;
using namespace std;

int main(int argc, char *argv[])
{
    string line = "12345";
    regex pattern("^123");
    if (regex_match(line, pattern)) cout << "match." << endl;
    else cout << "not match." << endl;
    return 1;
}

And compile by command:

g++ -v -I /my_path/boost-1.49.0/include/boost -L /my_path/boost-1.49.0/lib main.cpp -lboost_regex -o example

and generate following errors:

Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
/usr/libexec/gcc/x86_64-redhat-linux/3.4.6/cc1plus -quiet -v -I /my_path/boost-1.49.0/include/boost/ -D_GNU_SOURCE main.cpp -quiet -dumpbase main.cpp -mtune=k8 -auxbase main -version -o /tmp/ccW0ON8y.s
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/my_path/boost-1.49.0/include/boost/
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/backward
/usr/local/include
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include
/usr/include
End of search list.
GNU C++ version 3.4.6 20060404 (Red Hat 3.4.6-9) (x86_64-redhat-linux)
        compiled by GNU C version 3.4.6 20060404 (Red Hat 3.4.6-9).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
as -V -Qy -o /tmp/ccpu82sB.o /tmp/ccW0ON8y.s
GNU assembler version 2.15.92.0.2 (x86_64-redhat-linux) using BFD version 2.15.92.0.2 20040927
/usr/libexec/gcc/x86_64-redhat-linux/3.4.6/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o example /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/3.4.6/crtbegin.o -L /my_path/boost-1.49.0/lib/ -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6 -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6 -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 /tmp/ccpu82sB.o -lboost_regex -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/3.4.6/crtend.o /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/crtn.o
/tmp/ccpu82sB.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_
traitsIcEESaIcEEC1EPKcjRKS3_+0x27): In function `boost::basic_regex<char, 
boost::regex_traits<char>, std::allocator<char> >::basic_regex(char const*, 
unsigned int, std::allocator<char> const&)':: 
undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, 
std::allocator<char> >::reg_expression(char const*, unsigned int, 
std::allocator<char> const&)'

/tmp/ccpu82sB.o(.gnu.linkonce.t.
_ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEED1Ev+0x11): In function 
`boost::basic_regex<char, boost::regex_traits<char>, 
std::allocator<char>>::~basic_regex()':
: undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, 
std::allocator<char> >::~reg_expression()'
/tmp/ccpu82sB.o(.gnu.linkonce.t.
_ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub
_matchIS6_EEENS_12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_
14reg_expressionIcSB_SC_EENS_15regex_constants12_match_flagsE+0xa1): In function 
`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, 
std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, 
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, 
std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, 
boost::regex_traits<char>, std::allocator<char>>
::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char 
const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, 
boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > >, 
std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, 
std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, 
boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&, 
boost::regex_constants::_match_flags)':

however if I just compile with default boost that system administer installed

g++ -v main.cpp -lboost_regex -o example

Then it’s fine.

ldd example I got

libboost_regex.so.1 => /usr/lib64/libboost_regex.so.1 (0x0000002a95557000)

Due to some reason the I am asked not to update the boost in /usr/include/boost.
Is there anything that can help me solve with this problem that install boost in a local folder and just change the path how to include and link to use different versions?

I am not sure if this question is dumb or not, but I did search with google but mostly
related questions are not properly set -I, -L and -l in gcc command. I have no idea of
the error message above, really drive me mad. Any help is appreciated.

Thanks for your patience and time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:03:10+00:00Added an answer on June 2, 2026 at 5:03 pm

    Maybe it’s because in your compile command, you said to use /my_path/boost-1.49.0/include/boost as include path and then, in your source code you #include <boost/regex.hpp>.

    My guess is that regex.hpp is searched in /my_path/boost-1.49.0/include/boost/boost/regex.hpp. It is obviously not found, so system one is found.

    Could you try with :
    g++ -v -I /my_path/boost-1.49.0/include -L /my_path/boost-1.49.0/lib main.cpp -lboost_regex -o example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to install Boost on an unix cluster machine following the Boost
I am trying to install Boost so I can use it along with MinGW
Trying to install pear package and keep getting this strange error. Can you shed
When trying to install my 32bit service on a Windows 64bit machine my installer
I am trying to compile the latest Boost c++ libraries for Centos. I 've
I'm trying to install redmine on a Centos server. I already have PHP and
I am trying to install the Boost C++ libraries using these instructions . This
I'm trying install pycrypto on osx with easy_install and I'm getting the following error:
I am trying to install the latest version of Gearman. However, it keeps giving
I'm trying to build and install Boost 1.48.0 on OS X. I'd like boost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.