Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost linking error for boost filesystem, why?

Tags:

gcc

boost

I have built boost 1.44 on CentOS 5.5 using the gcc that is part of CentOS 5.5. All targets built fine. However trying to build a simple cpp file with nothing but an include of boost filesystem results in this linking error (3 times):

undefined reference to `boost::system::generic_category()'

I cannot see why this would happen. The lib is build, it can be seen, and yet I've seen this error discussed in google searches for versions of boost going back quite a while (when built with gcc). Anyone have any suggestions?

like image 550
Rhubarb Avatar asked Aug 29 '10 02:08

Rhubarb


People also ask

What is Boost Filesystem?

The Boost Filesystem Library provides portable facilities to query and manipulate paths, files, and directories. The motivation for the library is the need to be able to perform portable script-like operations from within C++ programs.

Is Boost filesystem header-only?

Unlike a large portion of the Boost ecosystem, boost::filesystem is not header-only. However, integration into a project was quite simple, and the functionality it provided was impressive.

What is Boost used for C++?

Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work well with the C++ Standard Library. Boost libraries are intended to be widely useful, and usable across a broad spectrum of applications.

Is Boost a STL?

Boost is meant to build on top of STL and many of the libraries are slated to become part of the standard library eventually. Boost libraries are generally less mature and less standard than STL.


1 Answers

Add -lboost_system to your LDFLAGS when linking your simple app.

like image 68
Sam Miller Avatar answered Sep 22 '22 22:09

Sam Miller