Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to install Boost library? How to add library to project?
Forum Updated to NodeBB v4.3 + New Features

How to install Boost library? How to add library to project?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
50 Posts 3 Posters 9.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aret777
    wrote on last edited by aret777
    #1

    Hello
    Started using your Qtcreator, but I need now link Boost library to my project (https://www.boost.org).
    How to do this? This tutorial is not very helpful https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html, cause autodetection is not working and manually I cant select nothing, even if I put Library folder inside the project folder.
    My project doesnt have anything yet, its basic new one.

    My Qt:
    download.png

    Message after library installation:
    download (1).png

    mzimmersM 1 Reply Last reply
    0
    • A aret777

      Hello
      Started using your Qtcreator, but I need now link Boost library to my project (https://www.boost.org).
      How to do this? This tutorial is not very helpful https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html, cause autodetection is not working and manually I cant select nothing, even if I put Library folder inside the project folder.
      My project doesnt have anything yet, its basic new one.

      My Qt:
      download.png

      Message after library installation:
      download (1).png

      mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #2

      @aret777 did you follow the instructions on the how-to page? Specifically, did you add the library declaration? From what I can see of your project file, it doesn't look like you did.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aret777
        wrote on last edited by aret777
        #3

        I tried to follow, but I cant select Subproject
        download (2).png

        from this part:
        3. In the Name field, give a name for the library. For example, mylib.
        4. Follow the instructions of the wizard until you get to the Project Management dialog. In the Add as a subproject to project list, select a project. For example, myapp.

        Its just grey

        1 Reply Last reply
        0
        • mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #4

          That screen is just for version control. Hit "Finish" and let's see what happens.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aret777
            wrote on last edited by aret777
            #5

            Okay, it created new Library Project
            download (3).png
            But when I try to do next steps:

            5. In the Projects view, right-click the project name to open the context menu and select Add Library > Internal Library > Next.
            6. In the Library field, select mylib, and then select Next.

            I cant select Library, there is none

            mzimmersM 1 Reply Last reply
            0
            • A aret777

              Okay, it created new Library Project
              download (3).png
              But when I try to do next steps:

              5. In the Projects view, right-click the project name to open the context menu and select Add Library > Internal Library > Next.
              6. In the Library field, select mylib, and then select Next.

              I cant select Library, there is none

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • A Offline
                A Offline
                aret777
                wrote on last edited by aret777
                #7

                Its not working.
                Here, I try to add External library: download (4).png
                I click on Browse button, opens Choose File window, but I cant select anything inside the library folder.
                If I try to add Internal library: download (5).png
                I cant select Library, I can only assign "Include path" parameter, but I cant click on Next...

                Or I need to follow this guide?
                https://doc.qt.io/qt-6/qmake-project-files.html#declaring-other-libraries
                Declaring Other Libraries part?

                mzimmersM 1 Reply Last reply
                0
                • A aret777

                  Its not working.
                  Here, I try to add External library: download (4).png
                  I click on Browse button, opens Choose File window, but I cant select anything inside the library folder.
                  If I try to add Internal library: download (5).png
                  I cant select Library, I can only assign "Include path" parameter, but I cant click on Next...

                  Or I need to follow this guide?
                  https://doc.qt.io/qt-6/qmake-project-files.html#declaring-other-libraries
                  Declaring Other Libraries part?

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by mzimmers
                  #8

                  @aret777 that's what I'd do -- the equivalent of this:

                  LIBS += -L/usr/local/lib -lmath
                  

                  In your project file.

                  EDIT:

                  Also, are you trying to add the library for all platforms? And what is in your bin.v2 folder?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    aret777
                    wrote on last edited by aret777
                    #9

                    You mean I need to write like this?
                    download (6).png

                    All platforms? Didnt understood the questions. I need library only for Desktop development, if that you mean, not mobile or ios.

                    bin.v2 folder was created when I tried to install library from command line, the first screenshot of this topic.
                    I used: ./bootstrap.sh --prefix=/home/user/Documents/BoostLibrary
                    then: ./b2
                    and it created this folder
                    download (7).png

                    mzimmersM 1 Reply Last reply
                    0
                    • A aret777

                      You mean I need to write like this?
                      download (6).png

                      All platforms? Didnt understood the questions. I need library only for Desktop development, if that you mean, not mobile or ios.

                      bin.v2 folder was created when I tried to install library from command line, the first screenshot of this topic.
                      I used: ./bootstrap.sh --prefix=/home/user/Documents/BoostLibrary
                      then: ./b2
                      and it created this folder
                      download (7).png

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #10

                      @aret777 look towards the bottom of the screenshot you posted of your boost install. It tells you what library path you need to add to your linker (which means you add it in your .pro file). You're not adding that path.

                      Also, please get in the habit of posting images inline rather than links to them. Thanks.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        aret777
                        wrote on last edited by
                        #11

                        Like this?
                        image1.png

                        mzimmersM 1 Reply Last reply
                        0
                        • A aret777

                          Like this?
                          image1.png

                          mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #12

                          @aret777 that looks better. What results are you getting now?

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            aret777
                            wrote on last edited by
                            #13

                            Well, I tried to insert library headers, but it says "no such file or directory"
                            image2.png

                            mzimmersM 1 Reply Last reply
                            0
                            • A aret777

                              Well, I tried to insert library headers, but it says "no such file or directory"
                              image2.png

                              mzimmersM Offline
                              mzimmersM Offline
                              mzimmers
                              wrote on last edited by
                              #14

                              @aret777 OK, that's because you added the library (the .so/.a) file, but you didn't add an entry for the header files.

                              I have to log off now (Christmas dinner!), but I'll try to check in later. Another entry to your .pro file should get you there.

                              1 Reply Last reply
                              1
                              • A Offline
                                A Offline
                                aret777
                                wrote on last edited by
                                #15

                                Well, I tried different approaches, different paths, but seems I am doing something wrong
                                Screenshot_1.png
                                Or "Another entry to my .pro file" means something different?

                                mzimmersM 1 Reply Last reply
                                0
                                • A aret777

                                  Well, I tried different approaches, different paths, but seems I am doing something wrong
                                  Screenshot_1.png
                                  Or "Another entry to my .pro file" means something different?

                                  mzimmersM Offline
                                  mzimmersM Offline
                                  mzimmers
                                  wrote on last edited by
                                  #16

                                  @aret777 sorry I wasn't clear. From what I can se, you need to do the following:

                                  1. remove the 2nd LIBS line
                                  2. remove whatever line is causing your Boost project file to show up.
                                  3. Add a line like this:
                                  INCLUDEPATH += /home/user/Documents/BoostLibrary
                                  
                                  A 1 Reply Last reply
                                  0
                                  • mzimmersM mzimmers

                                    @aret777 sorry I wasn't clear. From what I can se, you need to do the following:

                                    1. remove the 2nd LIBS line
                                    2. remove whatever line is causing your Boost project file to show up.
                                    3. Add a line like this:
                                    INCLUDEPATH += /home/user/Documents/BoostLibrary
                                    
                                    A Offline
                                    A Offline
                                    aret777
                                    wrote on last edited by aret777
                                    #17

                                    @mzimmers
                                    like this? I compile, nothing changes
                                    error.png

                                    Or, maybe... I dont need to add .hpp file to include library to project? But I tried now to include .so and .a files - no effect...

                                    Edit: I found the way to include .hpp files! But it gaves other errors...
                                    error2.png

                                    1 Reply Last reply
                                    0
                                    • mzimmersM Offline
                                      mzimmersM Offline
                                      mzimmers
                                      wrote on last edited by mzimmers
                                      #18

                                      No, something's still wrong with your .pro file. You need to get rid of that entry for the BoostLinkingTest.pro file.

                                      EDIT:
                                      disregard that last line.

                                      May I see the complete contents of your .pro file?

                                      A 1 Reply Last reply
                                      0
                                      • mzimmersM mzimmers

                                        No, something's still wrong with your .pro file. You need to get rid of that entry for the BoostLinkingTest.pro file.

                                        EDIT:
                                        disregard that last line.

                                        May I see the complete contents of your .pro file?

                                        A Offline
                                        A Offline
                                        aret777
                                        wrote on last edited by
                                        #19

                                        @mzimmers Its same from the beggining. I created now new project just for test, but same errors:
                                        Screenshot_1.png

                                        1 Reply Last reply
                                        0
                                        • mzimmersM Offline
                                          mzimmersM Offline
                                          mzimmers
                                          wrote on last edited by mzimmers
                                          #20

                                          My bad...I gave you bad advice on the LIBS entry. You need to specify the full path to the library you want to use. There may be a way to wildcard that; I'll do some looking. In the meantime, if you know specifically which boost libraries you need, modify your LIBS entry to contain the full path to those libraries.

                                          EDIT:

                                          Look at the LIBS entry on this page for how to explicitly add libraries to your project.

                                          A 1 Reply Last reply
                                          1

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved