BOOST & GCC, undefined reference to boost

2k views Asked by At

I must say, I'm new to using Boost libs, but I have used them for a few of my projects, and have been super pleased with them. Now, I would like to get all files with certain extension in one of my folders, so, looking it up online, I found this>How to get list of files with a specific extension in a given folder I'm using Code Blocks on Windows 7.

I have done everything it seemed required, and when I try to compile it, I get three errors>

C:\boost_1_58_0\boost\system\error_code.hpp|221|undefined reference to boost::system::generic_category()'| C:\boost_1_58_0\boost\system\error_code.hpp|222|undefined reference to boost::system::generic_category()'| C:\boost_1_58_0\boost\system\error_code.hpp|223|undefined reference to `boost::system::system_category()'|

I was looking it up online, and found that, besides pointing my "Search directories (compiler and linker) to boost installation, I need to point it directly to boost system lib somehow.

I tried -lboost_system in my Linker settings, but that didn't solve it.

I'm hardly an expert here, so I'm asking you guys if you can help me.

Does anyone have any ideas?

1

There are 1 answers

6
Nielk On

You need to provide the path where your lib is with the -L option of GCC.

Check this section of Boost documentation