When I type make I get:

Linking CXX executable ../../bin/MyProgram
../../lib/libMP.a(MPL.cpp.o): In function `_GLOBAL__sub_I_mult_fmm2':
MPL.cpp:(.text.startup+0x15): undefined reference to `boost::system::generic_category()'
MPL.cpp:(.text.startup+0x1a): undefined reference to `boost::system::generic_category()'
MPL.cpp:(.text.startup+0x1f): undefined reference to `boost::system::system_category()'
../../lib/libThing.a(vases.cpp.o): In function `_GLOBAL__sub_I__ZN9Thing6VasesC2ERKN3Two9DimensionENS1_8DataTypeE':
Vases.cpp:(.text.startup+0x15): undefined reference to `boost::system::generic_category()'
Vases.cpp:(.text.startup+0x1a): undefined reference to `boost::system::generic_category()'
Vases.cpp:(.text.startup+0x1f): undefined reference to `boost::system::system_category()'

...

../../lib/libThing.a(HDF5_IO.cpp.o): In function     `Thing::HDF5_IO::createVolumeFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Two::GenericBoundingBox<double> const&, Two::Dimension const&, std::vector<Two::DataType, std::allocator<Two::DataType> > const&, unsigned int, unsigned int, double, double) const':
HDF5_IO.cpp:(.text+0x79c5): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../../lib/libThing.a(HDF5_IO.cpp.o): In function `Thing::HDF5_IO::writeVolumeFile(Thing::Volume const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int, unsigned long, unsigned long, unsigned long, bool) const':
HDF5_IO.cpp:(.text+0x97d1): undefined reference to `boost::thread::start_thread_noexcept()'
HDF5_IO.cpp:(.text+0x9b77): undefined reference to `boost::thread::join_noexcept()'
HDF5_IO.cpp:(.text+0x9fbb): undefined reference to `boost::thread::join_noexcept()'

...

and my link.txt file looks like

/usr/bin/g++    -O3 -O3 -DNDEBUG   CMakeFiles/MyProject.dir/main.cpp.o      
-o ../../bin/MyProject  -L/home/myname/Desktop/MyProject/build/lib -rdynamic -lboost_thread-mt -lboost_date_time-mt -lboost_regex 
-lboost_filesystem-mt -lboost_program_options-mt ../../lib/libfftw3.a  -lxcb -lXau -lXext -lX11 -lpetsc -lmpich -lmpl -lrt ../../lib/libflapack.a 
-lgfortran ../../lib/libfblas.a -lgfortran ../../lib/libMyProjectAPI.a -lfftw3  -lGLU -lGL -lpthread ../../lib/libfftw3.a -lxcb -lXau -lX11 -lpetsc -lmpich -lmpl -lrt 
../../lib/libflapack.a -lgfortran ../../lib/libfblas.a -lgfortran ../../lib/libfblas.a -lpthread -lboost_thread-mt -lboost_date_time-mt -lboost_regex 
-lboost_filesystem-mt -lboost_system-mt     -lboost_program_options-mt /home/myname/anaconda2/lib/libhdf5.so /home/myname/anaconda2/lib/libhdf5_hl.so 
-lrt /home/myname/anaconda2/lib/libz.so -ldl -lm /home/myname/anaconda2/lib/libhdf5_cpp.so 
/home/myname/anaconda2/lib/libhdf5_hl_cpp.so /home/myname/anaconda2/lib/libhdf5.so /home/myname/anaconda2/lib/libhdf5_hl.so -lrt /home/myname/anaconda2/lib/libz.so 
-ldl -lm /home/myname/anaconda2/lib/libhdf5_cpp.so /home/myname/anaconda2/lib/libhdf5_hl_cpp.so -Wl,-rpath,/home/myname/Desktop/MyProject/build/lib:/home/myname/anaconda2/lib 

Anyone know how to solve this? If I replace -lboost_system-mt with ../../lib/libboost_system-mt.a then I get the same error. And I see that in /home/myname/Desktop/MyProject/build/lib that libboost_system-mt.a clearly exists, so removing the -mt is not the problem.

I think the problem is because I'm trying to link the executable against libraries built with another compiler. I'm using g++ 5.2 and boost is already installed in usr/include. The program code I'm using has those libboost files in /home/myname/Desktop/MyProject/build/lib. I got this code to work properly on an original computer, but am now having these linker errors on my new computer. That original computer used g++ on I think version 4.8

I already installed libboost-system-dev on my new computer and it says I already have the latest version. Same when I try to install libboost-system-dev. However, locate libboost_system-mt.a shows that libboost_system-mt.a is not in usr/lib but only in /home/myname/Desktop/MyProject/build/lib

You probably need to add a "-L <boost-library-path>" and "-l boost_system-mt" to your make file linkage (usually LFLAGS). FWIW, you are also looking for a statically linked boost library. Most are shared libraries, which you should use unless you REALLY need static linkage. Since the library is in your build area, my guess is that you did not run "make install" as root after you build the libraries. You CAN add /home/myname/Desktop/MyProject/build/lib to your LD_LIBRARY_PATH environment variable... May or may not work.

BTW, have you ever built/installed 3rd party libraries on Linux/Unix before?

I'm rather new to Linux and Unix so I apologize that I don't follow alot of what you're saying

In which makefile and where in that makefile do I add "-L <boost-library-path>" and "-l boost_system-mt" ? My makefiles contents are below:
http://pastebin.com/nRHskYND for makefile in /home/myname/Desktop/MyProject/build
http://pastebin.com/TVq5fmPw for makefile in /home/myname/Desktop/MyProject/

I did notice in that second makefile that CMAKE_COMMAND is referring to gcc-4.6 and the different version of linux, which were for my original computer. I'm now using gcc-5.2 on a different version of Linux. _SOURCE_DIR and _BINARY_DIR are also set to the directory in my previous computer and not my current one. Do I need to modify these so they point to the directories in my current computer? I just tried to modify them to the correct directories in my new computer (such as changing CMAKE_COMMAND = /opt/olddirectory/cmake/cmake-2.8.9/oldlinuxversion/gcc-4.6/bin/cmake to CMAKE_COMMAND = /usr/bin/cmake), but I still get the same error when I type make in the build directory

Since the library is in your build area, my guess is that you did not run "make install" as root after you build the libraries

I don't understand what you're saying. You mean I should type make install instead of make to build and link my program? Or do you mean for boost?

You CAN add /home/myname/Desktop/MyProject/build/lib to your LD_LIBRARY_PATH environment variable... May or may not work

I just tried this but I got the same error as before

BTW, have you ever built/installed 3rd party libraries on Linux/Unix before?

other than with sudo apt-get, no I haven't

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.