Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Can't compile w/ boost one linux in C++(using boost/filesystem.hpp or other boost libraries I can code w/o error but compile fails.)
Can't compile w/ boost one linux in C++ [message #1072059] Mon, 22 July 2013 01:05 Go to next message
Michael Butler is currently offline Michael ButlerFriend
Messages: 3
Registered: July 2013
Junior Member
Admittedly I'm new to programming in general but to eliminate the possibility I'm to blame I copied sample code from the website as a test. I've included the source code I'm using as a test just to be safe. I don't see any errors in the code editor but when I try to compile I get the following errors:

"/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'"
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'

There are other errors as well but I believe these are the cause of the issue. I've spent an entire Saturday googling for an answer but nothing has worked. From what I've found I've tried to add /usr/include/boost and /usr/include to include paths -l. I've added -lboost_filesystem and -lboost_system to other flags in miscellaneous still I can't compile. I've installed libboost-all-dev from apt-get trying to cover all my bases but at this point I'm out of ideas and I'm hoping someone who's done it before can heal lead me in the right direction. Thanks in advance for the help. I'm really starting to enjoy programming and thing this could become either a long term hobby or carrier. The bellow was copied from the console:

g++ -I /usr/include -I /usr/include/boost -O0 -g3 -Wall -c -fmessage-length=0 -lboost_filesystem -lboost_system -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.cpp"

  • Attachment: main.cpp
    (Size: 0.34KB, Downloaded 251 times)
Re: Can't compile w/ boost one linux in C++ [message #1072565 is a reply to message #1072059] Tue, 23 July 2013 03:38 Go to previous messageGo to next message
Michael Butler is currently offline Michael ButlerFriend
Messages: 3
Registered: July 2013
Junior Member
So I tried to do the same thing on my Windows computer but this time I built boost from source and I still have the same issue. I ran a search for libboost_system on the C: (my only drive) and didn't find anything but on my linux machine I do have:

/usr/lib/libboost_system-mt.a
/usr/lib/libboost_system-mt.so
/usr/lib/libboost_system.a
/usr/lib/libboost_system.so
/usr/lib/libboost_system.so.1.49.0
/usr/lib/libboost_system.so.1.53.0

Could I be missing file?
Re: Can't compile w/ boost one linux in C++ [message #1072647 is a reply to message #1072059] Tue, 23 July 2013 07:57 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
"/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'"

That is an error message from the linker. You need to add the corresponding boost libraries.
Quote:
I've added -lboost_filesystem and -lboost_system to other flags in miscellaneous still I can't compile.

You are on the right way. But you should not add these flags to the compiler but to the linker page. Go to "C/C++ Build" -> "Settings" and then hit the "Libraries" item under "GCC C++ Linker". Here you should your libraries boost_filesystem and boost_system.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Can't compile w/ boost one linux in C++ [message #1072751 is a reply to message #1072647] Tue, 23 July 2013 12:24 Go to previous messageGo to next message
Michael Butler is currently offline Michael ButlerFriend
Messages: 3
Registered: July 2013
Junior Member
Axel Mueller wrote on Tue, 23 July 2013 03:57
Quote:
"/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'"

That is an error message from the linker. You need to add the corresponding boost libraries.
Quote:
I've added -lboost_filesystem and -lboost_system to other flags in miscellaneous still I can't compile.

You are on the right way. But you should not add these flags to the compiler but to the linker page. Go to "C/C++ Build" -> "Settings" and then hit the "Libraries" item under "GCC C++ Linker". Here you should your libraries boost_filesystem and boost_system.


That was exactly what I needed. I literally spent my entire weekend trying to figure this out and it turns out I was just entering the information in the wrong place. I can't begin to tell you how grateful I am. I've never asked for help before on anything so posting in here was quite the last resort. Is there a way I can mark your reply as correct for others to find the answer quicker than I? Really, thank you so much.
Re: Can't compile w/ boost one linux in C++ [message #1073237 is a reply to message #1072751] Wed, 24 July 2013 11:19 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
I can't begin to tell you how grateful I am.

It is always nice to get positive feedback.

Quote:
Is there a way I can mark your reply as correct for others to find the answer quicker than I?

It is already on the FAQ
http://wiki.eclipse.org/CDT/User/FAQ


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:no option under Makefile Project
Next Topic:Indexer issue with templates that use templates
Goto Forum:
  


Current Time: Thu Mar 28 10:16:06 GMT 2024

Powered by FUDForum. Page generated in 0.05339 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top