Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4620454
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:33:45+00:00 2026-05-22T02:33:45+00:00

I wrote a program in c++ leveraging header files from boost. When I compiled

  • 0

I wrote a program in c++ leveraging header files from boost. When I compiled it I noticed I had some undefined symbols for boost system and boost file system (which I expected). I’ve finally gotten my program compile and link, but I arguably don’t understand why. If someone could lend some insight on the following I would appreciated it.

The final compile statement is: g++ dcc_to_png.c -lboost_system-mt -lboost_filesystem-mt
but looking at boost/state/lib the library names listed under /cygdrive/c/Users/Joe/My\ Documents/My\ Dropbox/Code/boost_1_46_1/stage/lib are libboost_system.a and libboost_filesystem.a.

What I don’t understand is

a) What are these strings I’m using boost_system-mt etc? Where are they defined what do they refer to? How do they resolve to actual libs?

b) For some reason if I try to do this on my own, ld complains it can’t find the lib. For example:

g++ dcc_to_png.c -L”/cygdrive/c/Users/Joe/My Documents/My Dropbox/Code/boost_1_46_1/stage/lib” -llibboost_system.a -llibboost_filesystem.a

yields:

/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibboost_system.a
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibboost_filesystem.a
collect2: ld returned 1 exit status

c) In the statement that compiles + links, why do I have to use -mt at the end of boost_system? I understand what -mt denotes, but how does that resolve to a lib on my filesystem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:33:46+00:00Added an answer on May 22, 2026 at 2:33 am

    Okay – so found some stuff. First in terms of search paths see: http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html. This helps clarify search paths when you link.

    Secondly – note the idea of using -mt at the end of the name is from an older boost convention which is no longer necessary.

    See: http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/5177d8bf13791038?pli=1

    Last but not least – if you are a cygwin user like me, there are a few gotchas you should be aware of. When you install the devel tools you may have installed version of boost headers prior to 46_1 (which I am using). These will be in /usr/include/boost/ and if you use these headers after you build boost on your system your libs won’t match the headers you find and you will always get a undefined reference to boost::system::get_system_category() because these headers may expect you to reference the-mtlibs. If you didn't build boost on your box this will work fine if you just include a-mt` at the end of the lib in question (it did for me on another box, which was mind boggling until I figured it out).

    The answer to this for me was to back up (just in case) and then wipe out the headers in /usr/include/boost/ and then force include my source code’s boost headers ala -I and force link the full paths to my libs. This forces g++ to use the libs + the headers that match.

    $ g++ dcc_to_png.c dccinfo.c -I"$CODEDIR/boost_1_46_1/" -include dccinfo.h /usr/lib/filesystem/build/gcc-4.3.4/release/link-static/threading-multi/libboost_filesystem.a /usr/lib/system/build/gcc-4.3.4/release/link-static/threading-multi/libboost_system.a -o dcc_to_png.exe
    

    This works – but it will only work if g++ isn’t finding those old headers. If you haven’t built boost and you want this to work – I believe you can leave out the -I and just use -lboost_filesystem-mt -lboost_system-mt but this ABSOLUTELY depends on the VERSION of boost. (see the thread above).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a program that captures Ethernet packets from some NIC (i.e eth0) at
I wrote a program which includes writing and reading from database. When I run
I wrote a program using AutoIT to fetch information from a number of websites
I wrote a program out, which was all in one file, and the methods
I wrote a Java program to add and retrieve data from an MS Access.
I wrote program to control iTunes by monitoring keystrokes from with pyHooks and then
I wrote a program that forks some processes with fork(). I want to kill
I wrote a program, which open docx package and changes some <w:t> -text in
I wrote a program in c++ in VC++2008 with boost library for regular expression.
I wrote a program to generate large .SQL files for quickly populating very large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.