title: undefined reference to `boost::system::system_category()'
body: <p>Although there are a lot of questions about this, I cannot find the right way to solve my problem.I make use of the <code>libboost_system</code>in my project, and I add the <code>Libs:=libconfig++ libboost_thread libboost_system</code> in the makefile,but it still never work.</p>
  
  <p>The environment of my machine：</p>
  
  <pre><code> - Ubuntu 14.04.5 LTS
   - gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
   - libboost_1.54
  </code></pre>
  
  <p>So far, I have tried the following </p>
  
  <ol>
  <li>I write a test file to see if the boost library was installed correctly,The test file looks like this:
  [test.cpp][1]
  <a href="https://i.stack.imgur.com/Tb4I0.png" rel="nofollow noreferrer">https://i.stack.imgur.com/Tb4I0.png</a>, and then I compile with this command：<code>g++ test.cpp -g -o main -lboost_system -lboost_thread</code>,it does work in a right way. Does this mean that the boost library is installed correctly? In my opinion I think it's installed.</li>
  <li>I search the stackoverflow and find that lots of answer mention that the order of the libraries is important,so I check the order of the libs and put the <code>libbost_system</code>at the end of the Libs.It still get the same error.</li>
  <li>Then I find that few answer infer to <code>#define BOOST_ERROR_CODE_HEADER_ONLY</code>,and I have no idea how to add this definition so I fail to solve the problem in the end.</li>
  </ol>
  
  <p>Part of makefile of my project is shown below:</p>
  
  <pre><code>SOURCE_DIR := src
  COMPILER := g++
  BINARY_DIR := bin/lrelease
  CPPFLAGS := -Wall -g -O3 -std=c++11
  LIBS := -lpthread -lboost_thread -lconfig++ -lboost_system
  COMPILE.cpp = $(COMPILER) $(CFLAGS) $(CPPFLAGS) -c
  LINK.cpp = $(COMPILER) $(LIBS)
  %.o: %.cpp
  #$(call make-depend,$&lt;,$@,$(subst .o,.d,$@))
  $(COMPILE.cpp) $&lt; -o $@
  
  # $(call source-dir-to-binary-dir, directory-list)
  source-dir-to-binary-dir = $(addprefix $(BINARY_DIR)/,$1)
  
  # $(call source-to-object, source-file-list)
  source-to-object = $(call source-dir-to-binary-dir, $(subst .cpp,.o,$1))
  
  # $(subdirectory)
  subdirectory = $(patsubst %/module.mk,%,                \
                   $(word                                 \
                     $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
  define make-depend
      g++ -MM    \
           -MF$3         \
           -MP            \
           -MT$2         \
           $(CFLAGS)      \
           $(CPPFLAGS)    \
           $(TARGET_ARCH) \
           $1
  endef
  
  # $(call make-library, library-name, source-file-list)
  define make-library
    libraries += $(BINARY_DIR)/$1
    sources   += $2
  
    $(BINARY_DIR)/$1: $(call source-dir-to-binary-dir, $(subst .cpp,.o,$2))
      $(AR) $(ARFLAGS) $$@ $$^
  endef
  
  # $(call make-program, program-name, library-list, source-file-list)
  define make-program
    programs  += $(BINARY_DIR)/$1
    sources   += $3
  
    $(BINARY_DIR)/$1: $(call source-dir-to-binary-dir, $(subst .cpp,.o,$3) $2 )
      $(LINK.cpp) -o $$@ $$^ -lpthread
  endef
  
  # $(compile-rules)
  define compile-rules
    $(foreach f,$(local_src),$(call one-compile-rule,$(call source-to-object,$f),$f))
  endef
  
  # $(call one-compile-rule, binary-file, source-file)
  define one-compile-rule
    $1: $2
      $(call make-depend,$2,$1,$(subst .o,.d,$1))
      $(COMPILE.cpp) -o $1 $2
  endef
  
  # then the output dirs and make clean
  #
  #
  </code></pre>
  
  <p>I got the error as follow:</p>
  
  <pre><code>g++ -lpthread -lboost_thread -lconfig++ -lboost_system -o bin/lrelease/ buildmyProjectFromN3 bin/lrelease/BuildmyProjectFromN3/BuildmyProject.o bin/lrelease/libmyProject.a -lpthread
  bin/lrelease/libmyProject.a(myProjectBuilder.o):(.gcc_except_table+0x48c): undefined reference to `typeinfo for libconfig::FileIOException'
  bin/lrelease/libmyProject.a(myProjectBuilder.o): In function `boost:: thread_exception::thread_exception(int, char const*)':
  /usr/include/boost/thread/exceptions.hpp:51: undefined reference to `boost::system::system_category()'
  bin/lrelease/libmyProject.a(myProjectBuilder.o): In function `boost:: condition_error::condition_error(int, char const*)':
  /usr/include/boost/thread/exceptions.hpp:84: undefined reference to `boost: : system::system_category()'
  bin/lrelease/libmyProject.a(myProjectBuilder.o): In function `interruption_checker':
  /usr/include/boost/thread/pthread/thread_data.hpp:187: undefined reference to `boost::detail::get_current_thread_data()'
  bin/lrelease/libmyProject.a(myProjectBuilder.o): In function `boost:: condition_variable::wait(boost::unique_lock&lt;boost::mutex&gt;&amp;)':
  /usr/include/boost/thread/pthread/condition_variable.hpp:84: undefined reference to `boost: : this_thread::interruption_point()'
  bin/lrelease/libmyProject.a(myProjectBuilder.o): In function `boost:: shared_mutex::lock_shared()':
  /usr/include/boost/thread/pthread/shared_mutex.hpp:186: undefined reference to `boost::this_thread::disable_interruption::disable_interruption()'
  /usr/include/boost/thread/pthread/shared_mutex.hpp:193: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
  /usr/include/boost/thread/pthread/shared_mutex.hpp:193: undefined reference to `boost::this_thread::disable_interruption::~disable_interruption()'
  ...
  ...
  ...
  </code></pre>
  
  <p>Add or without <code>L/usr/lib</code>：<code>#LIBS := -lpthread -lboost_system -lboost_thread -lconfig++  -L/usr/lib</code> seems to make no difference.Neither works properly.</p>
  
  <p>I can be sure that the code is correct and can run correctly on other servers.So,I really don't know where the problem is.
  I will be appreciate if I could get any useful information about the error，Thank you very much:)</p>