Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Adding Boost to Creator
Forum Updated to NodeBB v4.3 + New Features

Adding Boost to Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 4 Posters 2.3k Views
  • 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
    A123
    wrote on 7 May 2023, 12:02 last edited by
    #1

    I have lines such as

    #include<boost/algorithm/string.hpp>
    

    I add

    INCLUDEPATH += /usr/include/boost
    

    or

    INCLUDEPATH += /usr/include/
    

    to my .pro file

    but it still errors out saying no file or directory. What is the problem?

    J 1 Reply Last reply 7 May 2023, 12:08
    0
    • A A123
      7 May 2023, 12:02

      I have lines such as

      #include<boost/algorithm/string.hpp>
      

      I add

      INCLUDEPATH += /usr/include/boost
      

      or

      INCLUDEPATH += /usr/include/
      

      to my .pro file

      but it still errors out saying no file or directory. What is the problem?

      J Online
      J Online
      JonB
      wrote on 7 May 2023, 12:08 last edited by
      #2

      @A123 And where exactly is your boost/algorithm/string.hpp file?

      A 1 Reply Last reply 7 May 2023, 12:28
      0
      • J JonB
        7 May 2023, 12:08

        @A123 And where exactly is your boost/algorithm/string.hpp file?

        A Offline
        A Offline
        A123
        wrote on 7 May 2023, 12:28 last edited by
        #3

        @JonB as the path says in

        usr/include/boost/algorithm
        

        for linux.

        J 1 Reply Last reply 7 May 2023, 12:39
        0
        • A A123
          7 May 2023, 12:28

          @JonB as the path says in

          usr/include/boost/algorithm
          

          for linux.

          J Online
          J Online
          JonB
          wrote on 7 May 2023, 12:39 last edited by
          #4

          @A123
          usr/include/boost/algorithm is a relative path. We need to know an absolute one. I will assume you mean

          /usr/include/boost/algorithm
          

          In that case to find <boost/algorithm/string.hpp> you will need INCLUDEPATH += /usr/include/. Which it may already have, and g++ should be looking in /usr/include anyway.

          From a terminal copy & paste

          ls -l /usr/include/boost/algorithm/string.hpp
          

          and show the output.

          A 1 Reply Last reply 7 May 2023, 20:28
          3
          • J JonB
            7 May 2023, 12:39

            @A123
            usr/include/boost/algorithm is a relative path. We need to know an absolute one. I will assume you mean

            /usr/include/boost/algorithm
            

            In that case to find <boost/algorithm/string.hpp> you will need INCLUDEPATH += /usr/include/. Which it may already have, and g++ should be looking in /usr/include anyway.

            From a terminal copy & paste

            ls -l /usr/include/boost/algorithm/string.hpp
            

            and show the output.

            A Offline
            A Offline
            A123
            wrote on 7 May 2023, 20:28 last edited by
            #5

            @JonB

            -rw-r--r-- 1 root root 1061 Mar 16  2022 /usr/include/boost/algorithm/string.hpp
            
            J 1 Reply Last reply 8 May 2023, 06:41
            0
            • K Offline
              K Offline
              Kent-Dorfman
              wrote on 7 May 2023, 23:05 last edited by Kent-Dorfman 5 Jul 2023, 23:07
              #6

              if boost is installed as /usr/include/boost then your .pro file should not require any tweaking at all.

              #include <boost/whatever.hpp>

              should be adequate since /usr/include is a default search area.

              Only place it gets mucky is when the chosen boost classes are not completely implemented as header file templates...such as boost::filesystem::

              and cannot remember whether the preprocessor requires a space after #include. You don't have one.

              C 1 Reply Last reply 8 May 2023, 00:56
              0
              • K Kent-Dorfman
                7 May 2023, 23:05

                if boost is installed as /usr/include/boost then your .pro file should not require any tweaking at all.

                #include <boost/whatever.hpp>

                should be adequate since /usr/include is a default search area.

                Only place it gets mucky is when the chosen boost classes are not completely implemented as header file templates...such as boost::filesystem::

                and cannot remember whether the preprocessor requires a space after #include. You don't have one.

                C Offline
                C Offline
                ChrisW67
                wrote on 8 May 2023, 00:56 last edited by ChrisW67 5 Aug 2023, 00:57
                #7

                @Kent-Dorfman said in Adding Boost to Creator:

                cannot remember whether the preprocessor requires a space after #include.

                My GCC 11.3 does not require a space. YMMV

                if boost is installed as /usr/include/boost then your .pro file should not require any tweaking at all.

                This is certainly the case on my Ubuntu machine. Nothing new required in the PRO file for that particular Boost header-only component.

                Including </usr/include/boost/filesystem.hpp>, or any other Boost component that must be compiled separately, and attempting to use any function within will generate link time errors like this:

                g++ -Wl,-O1 -o tt main.o   /usr/lib/x86_64-linux-gnu/libQt5Gui.so /usr/lib/x86_64-linux-gnu/libQt5Core.so -lGL -lpthread   
                /usr/bin/ld: main.o: in function `main':
                main.cpp:(.text.startup+0xa7): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
                collect2: error: ld returned 1 exit status
                make: *** [Makefile:190: tt] Error 1
                

                This is possibly what @A123 is seeing.
                These Boost components will require

                LIBS += -lboost_filesystem
                

                or similar to function.

                @A123: If you cannot work it out, please post all the Boost-related #includes and the actual error message(s) with a small amount of context.

                A 1 Reply Last reply 8 May 2023, 06:26
                0
                • C ChrisW67
                  8 May 2023, 00:56

                  @Kent-Dorfman said in Adding Boost to Creator:

                  cannot remember whether the preprocessor requires a space after #include.

                  My GCC 11.3 does not require a space. YMMV

                  if boost is installed as /usr/include/boost then your .pro file should not require any tweaking at all.

                  This is certainly the case on my Ubuntu machine. Nothing new required in the PRO file for that particular Boost header-only component.

                  Including </usr/include/boost/filesystem.hpp>, or any other Boost component that must be compiled separately, and attempting to use any function within will generate link time errors like this:

                  g++ -Wl,-O1 -o tt main.o   /usr/lib/x86_64-linux-gnu/libQt5Gui.so /usr/lib/x86_64-linux-gnu/libQt5Core.so -lGL -lpthread   
                  /usr/bin/ld: main.o: in function `main':
                  main.cpp:(.text.startup+0xa7): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
                  collect2: error: ld returned 1 exit status
                  make: *** [Makefile:190: tt] Error 1
                  

                  This is possibly what @A123 is seeing.
                  These Boost components will require

                  LIBS += -lboost_filesystem
                  

                  or similar to function.

                  @A123: If you cannot work it out, please post all the Boost-related #includes and the actual error message(s) with a small amount of context.

                  A Offline
                  A Offline
                  A123
                  wrote on 8 May 2023, 06:26 last edited by
                  #8

                  @ChrisW67 said in Adding Boost to Creator:

                  @A123: If you cannot work it out, please post all the Boost-related #includes and the actual error message(s) with a small amount of context.

                  Offending code sample (missing string.hpp)
                  erroredcode.png

                  Error List
                  issuelist.png

                  Top of .pro file
                  pro_file.png

                  Location of boost files...ex string.hpp
                  stringhlocation.png

                  Build environment
                  buildenvironment.png

                  1 Reply Last reply
                  0
                  • A A123
                    7 May 2023, 20:28

                    @JonB

                    -rw-r--r-- 1 root root 1061 Mar 16  2022 /usr/include/boost/algorithm/string.hpp
                    
                    J Online
                    J Online
                    JonB
                    wrote on 8 May 2023, 06:41 last edited by JonB 5 Aug 2023, 06:44
                    #9

                    @A123
                    There is something we do not understand going on here. In principle given that you have #include<boost/algorithm/string.hpp> it should be picking that up /usr/include/boost/algorithm/string.hpp.

                    Please open a terminal somewhere (some other empty directory within your /home area). Create file.cpp containing just:

                    #include <boost/algorithm/string.hpp>
                    

                    (It should make no difference, but I have put a space before the <). Now just type in

                    g++ -c file.cpp
                    

                    What do you get?

                    Then try:

                    g++ -c -I/usr/include fred.cpp
                    

                    Now try changing the <..> to "...", i.e. #include "boost/algorithm/string.hpp" with that second command-line again.

                    Finally, try #include "/usr/include/boost/algorithm/string.hpp", so the -I... argument is irrelevant.

                    Obviously we are only interested in what the compiler has to say about the #include line. I have suggested 4 things to try here. Do any of these work? Which work/fail?

                    A 1 Reply Last reply 8 May 2023, 07:53
                    0
                    • J JonB
                      8 May 2023, 06:41

                      @A123
                      There is something we do not understand going on here. In principle given that you have #include<boost/algorithm/string.hpp> it should be picking that up /usr/include/boost/algorithm/string.hpp.

                      Please open a terminal somewhere (some other empty directory within your /home area). Create file.cpp containing just:

                      #include <boost/algorithm/string.hpp>
                      

                      (It should make no difference, but I have put a space before the <). Now just type in

                      g++ -c file.cpp
                      

                      What do you get?

                      Then try:

                      g++ -c -I/usr/include fred.cpp
                      

                      Now try changing the <..> to "...", i.e. #include "boost/algorithm/string.hpp" with that second command-line again.

                      Finally, try #include "/usr/include/boost/algorithm/string.hpp", so the -I... argument is irrelevant.

                      Obviously we are only interested in what the compiler has to say about the #include line. I have suggested 4 things to try here. Do any of these work? Which work/fail?

                      A Offline
                      A Offline
                      A123
                      wrote on 8 May 2023, 07:53 last edited by A123 5 Aug 2023, 07:53
                      #10

                      @JonB

                      All work to generate file.o except

                      g++ -c -I/usr/include fred.cpp which has no such file or directory

                      J 1 Reply Last reply 8 May 2023, 08:18
                      0
                      • A A123
                        8 May 2023, 07:53

                        @JonB

                        All work to generate file.o except

                        g++ -c -I/usr/include fred.cpp which has no such file or directory

                        J Online
                        J Online
                        JonB
                        wrote on 8 May 2023, 08:18 last edited by JonB 5 Aug 2023, 08:26
                        #11

                        @A123

                        g++ -c -I/usr/include fred.cpp which has no such file or directory

                        Well, that somehow looks like the situation you seem to be in from Creator.

                        What I really don't get is you are saying

                        g++ -c file.cpp
                        

                        does work, while

                        g++ -c -I/usr/include fred.cpp
                        

                        does not. Please confirm this is indeed exactly the case? It is vital we are 100% clear on this.

                        Now that is weird, because the -I... only adds directories to search. Since you say it worked OK without this I cannot understand how adding could prevent the file being found.

                        Next test:

                        g++ -c -I/rubbish file.cpp    # then does this work or fail??
                        

                        I also asked you to try changing the #include from <...> to "...". Did you do that? I am only interested if that made it behave differently in any case?

                        A 1 Reply Last reply 8 May 2023, 20:42
                        0
                        • J JonB
                          8 May 2023, 08:18

                          @A123

                          g++ -c -I/usr/include fred.cpp which has no such file or directory

                          Well, that somehow looks like the situation you seem to be in from Creator.

                          What I really don't get is you are saying

                          g++ -c file.cpp
                          

                          does work, while

                          g++ -c -I/usr/include fred.cpp
                          

                          does not. Please confirm this is indeed exactly the case? It is vital we are 100% clear on this.

                          Now that is weird, because the -I... only adds directories to search. Since you say it worked OK without this I cannot understand how adding could prevent the file being found.

                          Next test:

                          g++ -c -I/rubbish file.cpp    # then does this work or fail??
                          

                          I also asked you to try changing the #include from <...> to "...". Did you do that? I am only interested if that made it behave differently in any case?

                          A Offline
                          A Offline
                          A123
                          wrote on 8 May 2023, 20:42 last edited by A123 5 Aug 2023, 20:43
                          #12

                          @JonB

                          I have file.cpp in sampleproject in the home directory. There is no fred.cpp file.

                          g++ -c -I/usr/include fred.cpp
                          

                          gives me

                          cc1plus: fatal error: fred.cpp: No such file or directory
                          compilation terminated.
                          
                          g++ -c file.cpp
                          

                          works to generate file.o

                          g++ -c -I/rubbish file.cpp
                          

                          works

                          changing from <> to "" surrounding the include works.

                          I tried to start a new project in QT creator with file.cpp and the boost include was still not picked up.
                          In addition there is no usr/include in the system PATH variable when I

                          echo $PATH
                          

                          Not sure if that matters

                          This is Linux Mint 21 BTW

                          J 1 Reply Last reply 8 May 2023, 22:52
                          0
                          • A A123
                            8 May 2023, 20:42

                            @JonB

                            I have file.cpp in sampleproject in the home directory. There is no fred.cpp file.

                            g++ -c -I/usr/include fred.cpp
                            

                            gives me

                            cc1plus: fatal error: fred.cpp: No such file or directory
                            compilation terminated.
                            
                            g++ -c file.cpp
                            

                            works to generate file.o

                            g++ -c -I/rubbish file.cpp
                            

                            works

                            changing from <> to "" surrounding the include works.

                            I tried to start a new project in QT creator with file.cpp and the boost include was still not picked up.
                            In addition there is no usr/include in the system PATH variable when I

                            echo $PATH
                            

                            Not sure if that matters

                            This is Linux Mint 21 BTW

                            J Online
                            J Online
                            JonB
                            wrote on 8 May 2023, 22:52 last edited by
                            #13

                            @A123
                            OK, I'm tired. Whenever I wrote file.cpp or fred.cpp they were supposed to be the same thing. I will try to stick to file.cpp.

                            There are 4 combinations to try

                            g++ -c -I/usr/include file.cpp  # where file.cpp contains <...>
                            g++ -c -I/rubbish file.cpp  # where file.cpp contains <...>
                            g++ -c -I/usr/include file.cpp  # where file.cpp contains "..."
                            g++ -c -I/rubbish file.cpp  # where file.cpp contains "..."
                            

                            Can you clearly & unequivocally state which of these work and which fail?

                            Now that you say plain g++ -c file.cpp works then why did you ever start adding things to INCLUDEPATH, that means it should have worked from the very start with nothing added?

                            A 1 Reply Last reply 9 May 2023, 07:10
                            1
                            • K Offline
                              K Offline
                              Kent-Dorfman
                              wrote on 9 May 2023, 05:47 last edited by
                              #14

                              I'm really beginning to sense a corrupted g++ compiler instance here. The stuff being described just shouldn't happen!

                              1 Reply Last reply
                              0
                              • J JonB
                                8 May 2023, 22:52

                                @A123
                                OK, I'm tired. Whenever I wrote file.cpp or fred.cpp they were supposed to be the same thing. I will try to stick to file.cpp.

                                There are 4 combinations to try

                                g++ -c -I/usr/include file.cpp  # where file.cpp contains <...>
                                g++ -c -I/rubbish file.cpp  # where file.cpp contains <...>
                                g++ -c -I/usr/include file.cpp  # where file.cpp contains "..."
                                g++ -c -I/rubbish file.cpp  # where file.cpp contains "..."
                                

                                Can you clearly & unequivocally state which of these work and which fail?

                                Now that you say plain g++ -c file.cpp works then why did you ever start adding things to INCLUDEPATH, that means it should have worked from the very start with nothing added?

                                A Offline
                                A Offline
                                A123
                                wrote on 9 May 2023, 07:10 last edited by
                                #15

                                @JonB

                                There are 4 combinations to try

                                All 4 generate file.o

                                Now that you say plain g++ -c file.cpp works then why did you ever start adding things to INCLUDEPATH, that means it should have worked from the very start with nothing added?

                                I was trying to get things to work from the QT creator IDE which still doesn't work. When I tried things out through terminal like you suggested it is able to find the boost library for the simple example. So I think the problem is some setting within QT creator itself.

                                For reference I am using QT creator 8.0.1, QT 6.3.1, and the QT6 Kit

                                J 1 Reply Last reply 9 May 2023, 08:17
                                0
                                • A A123
                                  9 May 2023, 07:10

                                  @JonB

                                  There are 4 combinations to try

                                  All 4 generate file.o

                                  Now that you say plain g++ -c file.cpp works then why did you ever start adding things to INCLUDEPATH, that means it should have worked from the very start with nothing added?

                                  I was trying to get things to work from the QT creator IDE which still doesn't work. When I tried things out through terminal like you suggested it is able to find the boost library for the simple example. So I think the problem is some setting within QT creator itself.

                                  For reference I am using QT creator 8.0.1, QT 6.3.1, and the QT6 Kit

                                  J Online
                                  J Online
                                  JonB
                                  wrote on 9 May 2023, 08:17 last edited by JonB 5 Sept 2023, 08:20
                                  #16

                                  @A123 said in Adding Boost to Creator:

                                  All 4 generate file.o

                                  OK. Not sure that was the impression I got previously, but I get it now. That ought to be a good start!

                                  So I think the problem is some setting within QT creator itself.

                                  Creator does not do compiling itself. It is an IDE which calls on external tools (e.g. g++) to do compilations.

                                  Let's start by being 100.000% clear. Your screenshot shows errors. Do you indeed get these when you COMPILE ? If you only get these when looking at your source code in the IDE, not when you actually compile, now is the time to say so! That would be a totally different situation.... So please make this crystal clear?

                                  Assuming you get them when you allow Creator to invoke the compiler. Then in principle there are really/mostly only two things in Creator which affect this:

                                  • Show the actual command-line being issued to compile the file. You can find this in Creator on the Compiler Output pane.

                                  • There is a Build Environment setting. That allows environment variables to be passed to the compiler which we do not see on its command-line. Do you have anything of interest there?

                                  You could show these two.

                                  One other random thought: you do not have a sub-directory named boost in, say, your source directory, or perhaps one level above it, do you??

                                  You might also try the following from a terminal:

                                  find / -name boost -type d -print
                                  

                                  Does it only report one directory named boost? Just in /usr/include, nowhere else, right?

                                  Last thing: you might try setting up a brand new project in a brand new directory as a Qt project. Add only the file.cpp containing just the #include line. Try to compile. Success or failure?

                                  A 1 Reply Last reply 9 May 2023, 22:21
                                  1
                                  • J JonB
                                    9 May 2023, 08:17

                                    @A123 said in Adding Boost to Creator:

                                    All 4 generate file.o

                                    OK. Not sure that was the impression I got previously, but I get it now. That ought to be a good start!

                                    So I think the problem is some setting within QT creator itself.

                                    Creator does not do compiling itself. It is an IDE which calls on external tools (e.g. g++) to do compilations.

                                    Let's start by being 100.000% clear. Your screenshot shows errors. Do you indeed get these when you COMPILE ? If you only get these when looking at your source code in the IDE, not when you actually compile, now is the time to say so! That would be a totally different situation.... So please make this crystal clear?

                                    Assuming you get them when you allow Creator to invoke the compiler. Then in principle there are really/mostly only two things in Creator which affect this:

                                    • Show the actual command-line being issued to compile the file. You can find this in Creator on the Compiler Output pane.

                                    • There is a Build Environment setting. That allows environment variables to be passed to the compiler which we do not see on its command-line. Do you have anything of interest there?

                                    You could show these two.

                                    One other random thought: you do not have a sub-directory named boost in, say, your source directory, or perhaps one level above it, do you??

                                    You might also try the following from a terminal:

                                    find / -name boost -type d -print
                                    

                                    Does it only report one directory named boost? Just in /usr/include, nowhere else, right?

                                    Last thing: you might try setting up a brand new project in a brand new directory as a Qt project. Add only the file.cpp containing just the #include line. Try to compile. Success or failure?

                                    A Offline
                                    A Offline
                                    A123
                                    wrote on 9 May 2023, 22:21 last edited by A123 5 Sept 2023, 22:52
                                    #17

                                    @JonB

                                    Let's start by being 100.000% clear. Your screenshot shows errors. Do you indeed get these when you COMPILE ? If you only get these when looking at your source code in the IDE, not when you actually compile, now is the time to say so! That would be a totally different situation.... So please make this crystal clear?

                                    The line is labeled with a 'no such file or directory' error as soon as I paste it into the Creator code edit window. It pops up again in compile output when I attempt to build the project.

                                    Assuming you get them when you allow Creator to invoke the compiler. Then in principle there are really/mostly only two things in Creator which affect this:

                                    I put an empty file with the include in a sample project.

                                    15:02:39: Running steps for project sampleproj2...
                                    15:02:39: Starting: "/app/bin/qmake" /home/samp/sampleproj2/sampleproj2.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
                                    15:02:39: The process "/app/bin/qmake" exited normally.
                                    15:02:39: Starting: "/usr/bin/make" -f /home/samp/build-sampleproj2-Qt6-Debug/Makefile qmake_all
                                    make: Nothing to be done for 'qmake_all'.
                                    15:02:39: The process "/usr/bin/make" exited normally.
                                    15:02:39: Starting: "/usr/bin/make" -j16
                                    g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -fPIC -DQT_QML_DEBUG -I../sampleproj2 -I. -I/app/mkspecs/linux-g++ -o file.o ../sampleproj2/file.cpp
                                    ../sampleproj2/file.cpp:1:10: fatal error: boost/algorithm/string.hpp: No such file or directory
                                        1 | #include <boost/algorithm/string.hpp>
                                          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    compilation terminated.
                                    make: *** [Makefile:875: file.o] Error 1
                                    15:02:39: The process "/usr/bin/make" exited with code 2.
                                    Error while building/deploying project sampleproj2 (kit: Qt6)
                                    When executing step "Make"
                                    15:02:39: Elapsed time: 00:00.
                                    

                                    There is a Build Environment setting. That allows environment variables to be passed to the compiler which we do not see on its command-line. Do you have anything of interest there?
                                    be3.png be2.png be1.png

                                    One other random thought: you do not have a sub-directory named boost in, say, your source directory, or perhaps one level above it, do you??

                                    nope

                                    Does it only report one directory named boost? Just in /usr/include, nowhere else, right?

                                    sudo find / -name boost -type d -print
                                    find: ‘/run/user/1000/doc’: Permission denied
                                    find: ‘/run/user/1000/gvfs’: Permission denied
                                    /usr/lib/python3/dist-packages/boost
                                    /usr/lib/llvm-14/include/clang-tidy/boost
                                    /usr/include/boost
                                    /usr/include/boost/hana/ext/boost
                                    /usr/include/boost/chrono/typeof/boost
                                    

                                    Last thing: you might try setting up a brand new project in a brand new directory as a Qt project. Add only the file.cpp containing just the #include line. Try to compile. Success or failure?

                                    Failure as shown above.

                                    J 1 Reply Last reply 10 May 2023, 06:16
                                    0
                                    • A A123
                                      9 May 2023, 22:21

                                      @JonB

                                      Let's start by being 100.000% clear. Your screenshot shows errors. Do you indeed get these when you COMPILE ? If you only get these when looking at your source code in the IDE, not when you actually compile, now is the time to say so! That would be a totally different situation.... So please make this crystal clear?

                                      The line is labeled with a 'no such file or directory' error as soon as I paste it into the Creator code edit window. It pops up again in compile output when I attempt to build the project.

                                      Assuming you get them when you allow Creator to invoke the compiler. Then in principle there are really/mostly only two things in Creator which affect this:

                                      I put an empty file with the include in a sample project.

                                      15:02:39: Running steps for project sampleproj2...
                                      15:02:39: Starting: "/app/bin/qmake" /home/samp/sampleproj2/sampleproj2.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
                                      15:02:39: The process "/app/bin/qmake" exited normally.
                                      15:02:39: Starting: "/usr/bin/make" -f /home/samp/build-sampleproj2-Qt6-Debug/Makefile qmake_all
                                      make: Nothing to be done for 'qmake_all'.
                                      15:02:39: The process "/usr/bin/make" exited normally.
                                      15:02:39: Starting: "/usr/bin/make" -j16
                                      g++ -c -pipe -g -std=gnu++1z -Wall -Wextra -fPIC -DQT_QML_DEBUG -I../sampleproj2 -I. -I/app/mkspecs/linux-g++ -o file.o ../sampleproj2/file.cpp
                                      ../sampleproj2/file.cpp:1:10: fatal error: boost/algorithm/string.hpp: No such file or directory
                                          1 | #include <boost/algorithm/string.hpp>
                                            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      compilation terminated.
                                      make: *** [Makefile:875: file.o] Error 1
                                      15:02:39: The process "/usr/bin/make" exited with code 2.
                                      Error while building/deploying project sampleproj2 (kit: Qt6)
                                      When executing step "Make"
                                      15:02:39: Elapsed time: 00:00.
                                      

                                      There is a Build Environment setting. That allows environment variables to be passed to the compiler which we do not see on its command-line. Do you have anything of interest there?
                                      be3.png be2.png be1.png

                                      One other random thought: you do not have a sub-directory named boost in, say, your source directory, or perhaps one level above it, do you??

                                      nope

                                      Does it only report one directory named boost? Just in /usr/include, nowhere else, right?

                                      sudo find / -name boost -type d -print
                                      find: ‘/run/user/1000/doc’: Permission denied
                                      find: ‘/run/user/1000/gvfs’: Permission denied
                                      /usr/lib/python3/dist-packages/boost
                                      /usr/lib/llvm-14/include/clang-tidy/boost
                                      /usr/include/boost
                                      /usr/include/boost/hana/ext/boost
                                      /usr/include/boost/chrono/typeof/boost
                                      

                                      Last thing: you might try setting up a brand new project in a brand new directory as a Qt project. Add only the file.cpp containing just the #include line. Try to compile. Success or failure?

                                      Failure as shown above.

                                      J Online
                                      J Online
                                      JonB
                                      wrote on 10 May 2023, 06:16 last edited by
                                      #18

                                      @A123
                                      You have answered all my questions, but I'm sorry I just cannot spot what is wrong. You have shown:

                                      • The file /usr/include/boost/algorithm/string.hpp really does exist.
                                      • Sample programs with #include <boost/algorithm/string.hpp> compiled outside of Qt Creator work fine.
                                      • Programs, including a standalone one-liner project, with that line compiled inside Creator complain "no such file".
                                      • From Creator I cannot see anything significant in the command-line or the environment passed to g++ which would change the include search path behaviour.

                                      You might just verify one thing. So far you have used #include <boost/algorithm/string.hpp> which ought find /usr/include/boost/algorithm/string.hpp. Go look just in directory /usr/include/boost/ and pick some other .hpp or .h file which lives at that level. I don't know what is there. Say there is a boostfile.hpp. Then try #include <boost/boostfile.hpp>. I presume that fails equally? Otherwise if that succeeds there is something about the particular string.hpp file/path.

                                      Whatever the issue it should be something really simple! If I had your machine in front of me I would be confident of diagnosing whatever it is. But as it stands I am out of ideas. You will need someone else to look through with a fresh pair of eyes to see if they can spot what it might be.

                                      A 1 Reply Last reply 11 May 2023, 20:22
                                      0
                                      • J JonB
                                        10 May 2023, 06:16

                                        @A123
                                        You have answered all my questions, but I'm sorry I just cannot spot what is wrong. You have shown:

                                        • The file /usr/include/boost/algorithm/string.hpp really does exist.
                                        • Sample programs with #include <boost/algorithm/string.hpp> compiled outside of Qt Creator work fine.
                                        • Programs, including a standalone one-liner project, with that line compiled inside Creator complain "no such file".
                                        • From Creator I cannot see anything significant in the command-line or the environment passed to g++ which would change the include search path behaviour.

                                        You might just verify one thing. So far you have used #include <boost/algorithm/string.hpp> which ought find /usr/include/boost/algorithm/string.hpp. Go look just in directory /usr/include/boost/ and pick some other .hpp or .h file which lives at that level. I don't know what is there. Say there is a boostfile.hpp. Then try #include <boost/boostfile.hpp>. I presume that fails equally? Otherwise if that succeeds there is something about the particular string.hpp file/path.

                                        Whatever the issue it should be something really simple! If I had your machine in front of me I would be confident of diagnosing whatever it is. But as it stands I am out of ideas. You will need someone else to look through with a fresh pair of eyes to see if they can spot what it might be.

                                        A Offline
                                        A Offline
                                        A123
                                        wrote on 11 May 2023, 20:22 last edited by
                                        #19

                                        @JonB it also fails with other files. As a workaround I finally just moved boost to the Documents folder and it picked it up. It might be due to my system folders being on a separate partition which is standard practice in linux installs.

                                        1 Reply Last reply
                                        0

                                        1/19

                                        7 May 2023, 12:02

                                        • Login

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