Boost C++ Libraries: Ticket #783: Can't compile anything with boost - undefined reference https://svn.boost.org/trac10/ticket/783 <pre class="wiki">I doubt this is a bug - it's highly likely it's me being stupid. (Also, please bear in mind I've never really used c++ before... That probably means I'm not legally allowed to use Boost, but I'm kindda used to having filesystem operations, so I wanted to try it out... :-) Anyway! I downloaded boost from the website to my desktop, cd'ed to it, unpacked it and cd'ed inside. Then I ran: &gt;sudo bjam "-sTOOLS=gcc" install and waited for it to complete... So, after I did that, I figured I was ready to use boost... I found a file-system example on http://www.boost.org/libs/filesystem/example/simple_ls.cpp and tried compiling it: &gt; g++ simple_ls.cpp -o simple_ls But that gives me the following output: (WARNING! Pretty long copy-paste here...) soren@soren-laptop:~$ g++ simple_ls.cpp -o simple_ls /tmp/ccDCA1UI.o: In function `main': simple_ls.cpp:(.text+0x89): undefined reference to `boost::filesystem::initial_path()' simple_ls.cpp:(.text+0xb7): undefined reference to `boost::filesystem::native(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)' simple_ls.cpp:(.text+0xc6): undefined reference to `boost::filesystem::path::path(char const*, bool (*)(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;))' simple_ls.cpp:(.text+0xd8): undefined reference to `boost::filesystem::system_complete(boost::filesystem::path const&amp;)' simple_ls.cpp:(.text+0x17a): undefined reference to `boost::filesystem::exists(boost::filesystem::path const&amp;)' simple_ls.cpp:(.text+0x193): undefined reference to `boost::filesystem::path::native_file_string() const' simple_ls.cpp:(.text+0x208): undefined reference to `boost::filesystem::is_directory(boost::filesystem::path const&amp;)' simple_ls.cpp:(.text+0x222): undefined reference to `boost::filesystem::path::native_directory_string() const' simple_ls.cpp:(.text+0x2b5): undefined reference to `boost::filesystem::is_directory(boost::filesystem::path const&amp;)' simple_ls.cpp:(.text+0x2d7): undefined reference to `boost::filesystem::path::leaf() const' simple_ls.cpp:(.text+0x34a): undefined reference to `boost::filesystem::path::leaf() const' simple_ls.cpp:(.text+0x3f1): undefined reference to `boost::filesystem::path::leaf() const' simple_ls.cpp:(.text+0x56a): undefined reference to `boost::filesystem::path::native_file_string() const' /tmp/ccDCA1UI.o: In function `boost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&amp;)': simple_ls.cpp:(.text._ZN5boost10filesystem18directory_iteratorC1ERKNS0_4pathE[boost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&amp;)]+0x2b): undefined reference to `boost::filesystem::detail::dir_itr_init(boost::shared_ptr&lt;boost::filesystem::detail::dir_itr_imp&gt;&amp;, boost::filesystem::path const&amp;)' /tmp/ccDCA1UI.o: In function `boost::filesystem::directory_iterator::dereference() const': simple_ls.cpp:(.text._ZNK5boost10filesystem18directory_iterator11dereferenceEv[boost::filesystem::directory_iterator::dereference() const]+0xd): undefined reference to `boost::filesystem::detail::dir_itr_dereference(boost::shared_ptr&lt;boost::filesystem::detail::dir_itr_imp&gt; const&amp;)' /tmp/ccDCA1UI.o: In function `boost::filesystem::directory_iterator::increment()': simple_ls.cpp:(.text._ZN5boost10filesystem18directory_iterator9incrementEv[boost::filesystem::directory_iterator::increment()]+0xd): undefined reference to `boost::filesystem::detail::dir_itr_increment(boost::shared_ptr&lt;boost::filesystem::detail::dir_itr_imp&gt;&amp;)' collect2: ld returned 1 exit status this was run from the root of my home-dir... To me it looks like it doesn't get the boost-files included somehow (thought it MUST find them, otherwise the compiler would have complained about missing files)... Any thoughts? /Søren </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/783 Trac 1.4.3 nobody Wed, 29 Nov 2006 02:19:50 GMT <link>https://svn.boost.org/trac10/ticket/783#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/783#comment:1</guid> <description> <pre class="wiki">Logged In: NO You just forgot to link to the filesystem boost list, add smth like -lboost-filesystem to your linker flags or smth... But really, this isn't a question to ask here, ask in a c++ channel on irc. There's also #boost on freenode. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>fafnr</dc:creator> <pubDate>Wed, 29 Nov 2006 08:56:39 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/783#comment:2 https://svn.boost.org/trac10/ticket/783#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket Daryle Walker Wed, 02 Jul 2008 17:26:36 GMT component changed; severity set https://svn.boost.org/trac10/ticket/783#comment:3 https://svn.boost.org/trac10/ticket/783#comment:3 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">build</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Showstopper</span> </li> </ul> Ticket Daryle Walker Wed, 02 Jul 2008 17:36:55 GMT severity changed https://svn.boost.org/trac10/ticket/783#comment:4 https://svn.boost.org/trac10/ticket/783#comment:4 <ul> <li><strong>severity</strong> <span class="trac-field-old">Showstopper</span> → <span class="trac-field-new">Not Applicable</span> </li> </ul> Ticket