Find the answer to your Linux question:
Results 1 to 5 of 5
I am learning C++ and wish to include some Boost functions in my code. My machine is running Debian Linux with the pre-installed boost binarys. I have a couple of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8

    using binary c++ libraries


    I am learning C++ and wish to include some Boost functions in my code. My machine is running Debian Linux with the pre-installed boost binarys.

    I have a couple of questions:

    How do I include the library in my C++ code as there are no cpp or h files only binary files (eg /usr/lib/libboost_regex-d.so and /usr/lib/libboost_regex-d.a)

    How do I comipile the code. I am using DialogBlocks for creating forms using wxwidgets. The editor also compiles the code using the gcc compiler. Do I have to give an instruction to the compiler saying which file is requried and where to find it? If so, any ideas how this is done?

    Thanks in advance.

    Michae
    l

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Rather than figure out how to do it yourself,
    you can install the development libraries.
    libboost-dev seems to be the main package.

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8
    Quote Originally Posted by rcgreen View Post
    Rather than figure out how to do it yourself,
    you can install the development libraries.
    libboost-dev seems to be the main package.
    I see what you mean. I unistalled and reinstalled using libboost-deve and all the header files are now avialable.

    Thanks

  4. #4
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8

    Which folder to use and how to instruct the compiler/linker

    The problem I have now is informing the GCC compiler / linker where the libarary files are.
    The following folders have binary files in:
    boost_1_44_0/bin.v2
    boost_1_44_0/stage/lib

    Note,I have attached a picture of the folder tree structure.

    Which folder contains the library I should use. In fact what is the difference between the two folders contents.

    Also what instructions should I pass to the gcc compiler/linker?

    Michael
    Attached Images Attached Images

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,452
    For the linker use the LDFLAGS argument "-L /usr/local/boost_1_44_0/bin.v2/libs -L /usr/local/boost_1_44/stage/lib" assuming that each of these are the actual paths to the libraries you need to link. From the directory tree however I don't think you ran "make install" after building everything. If you had then all the stuff you need would be in /usr/local/lib or /usr/local/lib64. In that case the LDFLAGS components would be "-L /usr/local/lib" or "-L /usr/local/lib64" depending upon whether you built boost in 32-bit or 64-bit format.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •