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. #include repost
Forum Updated to NodeBB v4.3 + New Features

#include repost

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 7 Posters 1.2k Views 3 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.
  • B Bonnie

    @AnneRanch
    I think @hskoglund means you've made a typo...

    A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #9
    This post is deleted!
    1 Reply Last reply
    0
    • B Bonnie

      @AnneRanch
      I think @hskoglund means you've made a typo...

      A Offline
      A Offline
      Anonymous_Banned275
      wrote on last edited by
      #10

      @Bonnie Mia culpa - I DID MADE a typo

      J.HilkJ 1 Reply Last reply
      0
      • A Anonymous_Banned275

        Minor , insignificant detail not helping to resolve THIS #include issue.
        BTW - I just cut and pasted it from "an official" btscanner example .

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by Pl45m4
        #11

        @AnneRanch

        It's a general thing.
        As I've said in one of your other posts, examples are minimalistic standalone projects, that are (in most cases) not meant to get improved or extended even further.
        So, IMHO it's not a good idea to import a whole example to your own projects and take over the example's pro file...
        I don't want to question your whole idea, but I would say, that there are easier and faster ways to make your own BT Scanner "test" / "example" project.
        Or is there anything that forces you, to import the full example?


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        A 1 Reply Last reply
        0
        • A Anonymous_Banned275

          @Bonnie Mia culpa - I DID MADE a typo

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #12

          @AnneRanch to answer your original question, the pro- file offers you the possibility to expand the include path, via INCLUDPATH += ....

          in your case

          INCLUDEPATH +=$$PWD/../../bluetooth/btscanner
          

          should do the trick.

          But use it with caution, I find that using INCLUDEPATH convolutes the code more than that it makes it easier to read.
          But that maybe just me

          #include " file " ; searches local directory ONLY and stops
          #include <file> ; searches "above " local directory

          where did you get that from?

          the actual definition:

          1. #include <filename>: Searches for the file in implementation-defined manner. The intent of this syntax is to search for the files under control of the implementation. Typical implementations search only standard include directories. The standard C++ library and the standard C library are implicitly included in these standard include directories. The standard include directories usually can be controlled by the user through compiler options.
          2. #include "filename": Searches for the file in implementation-defined manner. The intent of this syntax is to search for the files that are not controlled by the implementation. Typical implementations first search the directory where the current file resides and, only if the file is not found, search the standard include directories as with (1).

          https://en.cppreference.com/w/cpp/preprocessor/include

          The only thing that "searches upward" that I now, is qmake in search of a .qmake.conf file
          But there may be more 🤷‍♂️


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          A 1 Reply Last reply
          5
          • Pl45m4P Pl45m4

            @AnneRanch

            It's a general thing.
            As I've said in one of your other posts, examples are minimalistic standalone projects, that are (in most cases) not meant to get improved or extended even further.
            So, IMHO it's not a good idea to import a whole example to your own projects and take over the example's pro file...
            I don't want to question your whole idea, but I would say, that there are easier and faster ways to make your own BT Scanner "test" / "example" project.
            Or is there anything that forces you, to import the full example?

            A Offline
            A Offline
            Anonymous_Banned275
            wrote on last edited by
            #13

            @Pl45m4 Agree with your approach, however, the initial question was about why "#include" does not work as expected AND
            why the project tree and project file entries make no difference OR more precisely does not effect the complication. My usage of btscanner is purely selfish – it works in Qt - as opposed to many other “sample codes” , and that is OK with me.

            What is NOT OK is tool likes Qt Creator messing with C language syntax by adding layers of
            poorly explained “STUFF” , such as inventing syntax “/../../xxx” where #include <FILIE>; should do.

            As far as “samples” being second grade code – something about advertising Qt comes to mind, and I shall leave that as is.

            JonBJ 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @AnneRanch to answer your original question, the pro- file offers you the possibility to expand the include path, via INCLUDPATH += ....

              in your case

              INCLUDEPATH +=$$PWD/../../bluetooth/btscanner
              

              should do the trick.

              But use it with caution, I find that using INCLUDEPATH convolutes the code more than that it makes it easier to read.
              But that maybe just me

              #include " file " ; searches local directory ONLY and stops
              #include <file> ; searches "above " local directory

              where did you get that from?

              the actual definition:

              1. #include <filename>: Searches for the file in implementation-defined manner. The intent of this syntax is to search for the files under control of the implementation. Typical implementations search only standard include directories. The standard C++ library and the standard C library are implicitly included in these standard include directories. The standard include directories usually can be controlled by the user through compiler options.
              2. #include "filename": Searches for the file in implementation-defined manner. The intent of this syntax is to search for the files that are not controlled by the implementation. Typical implementations first search the directory where the current file resides and, only if the file is not found, search the standard include directories as with (1).

              https://en.cppreference.com/w/cpp/preprocessor/include

              The only thing that "searches upward" that I now, is qmake in search of a .qmake.conf file
              But there may be more 🤷‍♂️

              A Offline
              A Offline
              Anonymous_Banned275
              wrote on last edited by
              #14

              @J-Hilk
              I will repeat what I have said already and add - the syntax for #inlcude has not changed since it was introduced. The Qt Creator adds stuff which is not only odd but is not used during compile.
              Yes, I did not cut and paste "the real Mc Coy" definition as you did.
              Was MY definition incorrect ?
              I am not sure if adding PATH (to pro file) is necessary - it is already in project tree and if it is important it should be added to pro file by Qt Creator.

              Appreciate all the comments and suggestions, it is very helpful to get my project going.

              Thanks

              1 Reply Last reply
              0
              • A Anonymous_Banned275

                @Pl45m4 Agree with your approach, however, the initial question was about why "#include" does not work as expected AND
                why the project tree and project file entries make no difference OR more precisely does not effect the complication. My usage of btscanner is purely selfish – it works in Qt - as opposed to many other “sample codes” , and that is OK with me.

                What is NOT OK is tool likes Qt Creator messing with C language syntax by adding layers of
                poorly explained “STUFF” , such as inventing syntax “/../../xxx” where #include <FILIE>; should do.

                As far as “samples” being second grade code – something about advertising Qt comes to mind, and I shall leave that as is.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #15

                @AnneRanch said in #include repost:

                What is NOT OK is tool likes Qt Creator messing with C language syntax by adding layers of
                poorly explained “STUFF” , such as inventing syntax “/../../xxx” where #include <FILIE>; should do.

                Qt Creator is an IDE, including a C/C++ editor and a debugger. It does not, and cannot, alter the syntax of any language. If it did, programs would not compile. The compiler/linker is not a Qt component.

                Whatever #includes you have shown in your code will conform to https://en.cppreference.com/w/cpp/preprocessor/include, or similar, as per @J-Hilk 's post. Assuming your are using gcc, its documentation should provide any details on handling/how to pass directories on the compile line, etc. #include <> tends to look in some system directories which #include "" does not. Handling of a relative path with .. is probably compiler-implementation-specific.

                A 1 Reply Last reply
                3
                • JonBJ JonB

                  @AnneRanch said in #include repost:

                  What is NOT OK is tool likes Qt Creator messing with C language syntax by adding layers of
                  poorly explained “STUFF” , such as inventing syntax “/../../xxx” where #include <FILIE>; should do.

                  Qt Creator is an IDE, including a C/C++ editor and a debugger. It does not, and cannot, alter the syntax of any language. If it did, programs would not compile. The compiler/linker is not a Qt component.

                  Whatever #includes you have shown in your code will conform to https://en.cppreference.com/w/cpp/preprocessor/include, or similar, as per @J-Hilk 's post. Assuming your are using gcc, its documentation should provide any details on handling/how to pass directories on the compile line, etc. #include <> tends to look in some system directories which #include "" does not. Handling of a relative path with .. is probably compiler-implementation-specific.

                  A Offline
                  A Offline
                  Anonymous_Banned275
                  wrote on last edited by
                  #16

                  @JonB This comments i misinterpreters this entire thread.
                  Nobody is challenging Qt as IDE "interface " to make and compiler / linker.
                  What I questioned is what appears superficial "includes" with no visible effect on processes. If common item likes #include has to be done manually we have very poorly functioning "IDE", nothing to do with complier.

                  Since you mentioned complier - where can I read Qt Creator compile options ?
                  I have 4 processor system and like to add "-j" option to speed things up.

                  But I'll post this separately - different subject

                  JonBJ Pl45m4P 2 Replies Last reply
                  0
                  • A Anonymous_Banned275

                    @JonB This comments i misinterpreters this entire thread.
                    Nobody is challenging Qt as IDE "interface " to make and compiler / linker.
                    What I questioned is what appears superficial "includes" with no visible effect on processes. If common item likes #include has to be done manually we have very poorly functioning "IDE", nothing to do with complier.

                    Since you mentioned complier - where can I read Qt Creator compile options ?
                    I have 4 processor system and like to add "-j" option to speed things up.

                    But I'll post this separately - different subject

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #17

                    @AnneRanch said in #include repost:

                    @JonB This comments i misinterpreters this entire thread.

                    No, it doesn't. You think that Qt Creator is doing something funny about #includes, and keep saying so. It is not.

                    1 Reply Last reply
                    1
                    • A Anonymous_Banned275

                      @JonB This comments i misinterpreters this entire thread.
                      Nobody is challenging Qt as IDE "interface " to make and compiler / linker.
                      What I questioned is what appears superficial "includes" with no visible effect on processes. If common item likes #include has to be done manually we have very poorly functioning "IDE", nothing to do with complier.

                      Since you mentioned complier - where can I read Qt Creator compile options ?
                      I have 4 processor system and like to add "-j" option to speed things up.

                      But I'll post this separately - different subject

                      Pl45m4P Offline
                      Pl45m4P Offline
                      Pl45m4
                      wrote on last edited by Pl45m4
                      #18

                      @AnneRanch said in #include repost:

                      I have 4 processor system and like to add "-j" option to speed things up.

                      https://stackoverflow.com/questions/8860712/setting-default-make-options-for-qt-creator

                      (4 processor cores, I assume)


                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                      ~E. W. Dijkstra

                      A 1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        Anonymous_Banned275
                        wrote on last edited by
                        #19
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • Pl45m4P Pl45m4

                          @AnneRanch said in #include repost:

                          I have 4 processor system and like to add "-j" option to speed things up.

                          https://stackoverflow.com/questions/8860712/setting-default-make-options-for-qt-creator

                          (4 processor cores, I assume)

                          A Offline
                          A Offline
                          Anonymous_Banned275
                          wrote on last edited by
                          #20

                          @Pl45m4 Pardon my ignorance , but -j is a complier option .
                          When I added it to "make" it did not show in compiler output.
                          Which brings another question - who is on first - "make" or "qmake" or both ?
                          And since I am not allowed to do multiple posts - why is there "build" and "rebuild" ? Back in the beginning of programming - when file was "dirty" it would get rebuild AUTOMATICALLY when "build" was requested anyway.
                          .

                          Pl45m4P JKSHJ 2 Replies Last reply
                          0
                          • A Anonymous_Banned275

                            @Pl45m4 Pardon my ignorance , but -j is a complier option .
                            When I added it to "make" it did not show in compiler output.
                            Which brings another question - who is on first - "make" or "qmake" or both ?
                            And since I am not allowed to do multiple posts - why is there "build" and "rebuild" ? Back in the beginning of programming - when file was "dirty" it would get rebuild AUTOMATICALLY when "build" was requested anyway.
                            .

                            Pl45m4P Offline
                            Pl45m4P Offline
                            Pl45m4
                            wrote on last edited by Pl45m4
                            #21

                            @AnneRanch

                            "Build" only builds (link +compile) files that have changed ("dirty" files).
                            "Rebuild" will build all files, regardless whether they have changed or not. And this could take several minutes or even more in huge projects.

                            The path in your error msg says "Qt_Repository Copy". Is that the right one? Did you move or rename any files? Try to rename any button (by double clicking on e.g. "Scan") in your current ui file (just the button text, not the actual widget name) and run your program. If the name is still the old one, your program is probably using a different ui file.


                            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                            ~E. W. Dijkstra

                            1 Reply Last reply
                            2
                            • A Anonymous_Banned275

                              @Pl45m4 Pardon my ignorance , but -j is a complier option .
                              When I added it to "make" it did not show in compiler output.
                              Which brings another question - who is on first - "make" or "qmake" or both ?
                              And since I am not allowed to do multiple posts - why is there "build" and "rebuild" ? Back in the beginning of programming - when file was "dirty" it would get rebuild AUTOMATICALLY when "build" was requested anyway.
                              .

                              JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on last edited by
                              #22

                              @AnneRanch said in #include repost:

                              who is on first - "make" or "qmake" or both ?

                              • qmake...
                                • ...parses your *.pro file and generates your Makefile
                                • ...parses your *.ui file and generates *.cpp and .h files
                                • (and more)
                              • make parses your Makefile and runs your build tools

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              1 Reply Last reply
                              3

                              • Login

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