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. Compilation issues when using #include<filesystem>
Forum Updated to NodeBB v4.3 + New Features

Compilation issues when using #include<filesystem>

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 5 Posters 3.5k Views 1 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.
  • P pingal

    Thanks for the reply.

    According to the link "Using this library may require additional compiler/linker options. GNU implementation prior to 9.1 requires linking with -lstdc++fs and LLVM implementation prior to LLVM 9.0 requires linking with -lc++fs"

    So i added the following lines in .pro file

    LIBS += -lstdc++fs
    

    Still the same output.

    P.S: I also tried

    LIBS += -lc++fs
    

    But the problem persists

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

    @pingal
    I do not know what precisely you are supposed to do here. But the errors you show earlier are compilation errors, so adding linker flags is not going to resolve that....

    P 1 Reply Last reply
    0
    • JonBJ JonB

      @pingal
      I do not know what precisely you are supposed to do here. But the errors you show earlier are compilation errors, so adding linker flags is not going to resolve that....

      P Offline
      P Offline
      pingal
      wrote on last edited by pingal
      #5

      @JonB exactly, that's the compilation errors and has nothing to do with the linker but i followed notes Kent-Dorfman has suggested

      I think this is some sort of bug (when std::filesystem is used in QT)

      JonBJ 1 Reply Last reply
      0
      • P pingal

        @JonB exactly, that's the compilation errors and has nothing to do with the linker but i followed notes Kent-Dorfman has suggested

        I think this is some sort of bug (when std::filesystem is used in QT)

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

        @pingal said in Compilation issues when using #include<filesystem>:

        I think this is some sort of bug (when std::filesystem is used in QT)

        Well you could test that in a standalone program without Qt?

        I have seen possible issues like https://www.reddit.com/r/cpp_questions/comments/f10d31/comment/fh11qat/?utm_source=reddit&utm_medium=web2x&context=3

        Your issue is most likely with MINGW. Its GCC may not be complete/up-to-date.

        Maybe you could play at https://godbolt.org/ ?

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote on last edited by Axel Spoerl
          #7

          Your compiler version (mingw8.1.0) is not suitable for the Qt version you are trying to compile with (6.0.2).
          See here for an overview.
          More specifically: for the MinGW version you use, you have to #include<experimental/filesystem> which is why you get the error.
          With more recent compilers (e.g. GCC10 or MinGW 11.2), -lstdc++fs is no longer necessary. If the missing linking instruction was the problem, you'd have had a linker rather than a compiler error.
          BRgds
          Axel

          Software Engineer
          The Qt Company, Oslo

          R 1 Reply Last reply
          5
          • P Offline
            P Offline
            pingal
            wrote on last edited by
            #8

            @Axel-Spoerl That really helped.

            I've added QT 6.2.3 along with MinGW 9.0.0 to QT Creator and the problem is solved.

            R 1 Reply Last reply
            0
            • P pingal

              @Axel-Spoerl That really helped.

              I've added QT 6.2.3 along with MinGW 9.0.0 to QT Creator and the problem is solved.

              R Offline
              R Offline
              rowan Samy
              wrote on last edited by
              #9

              @pingal how did you fix this bug I have the same issue

              JonBJ 1 Reply Last reply
              0
              • R rowan Samy

                @pingal how did you fix this bug I have the same issue

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

                @rowan-Samy
                Since @pingal already wrote

                I've added QT 6.2.3 along with MinGW 9.0.0 to QT Creator and the problem is solved.

                what have you done?

                R 1 Reply Last reply
                0
                • Axel SpoerlA Axel Spoerl

                  Your compiler version (mingw8.1.0) is not suitable for the Qt version you are trying to compile with (6.0.2).
                  See here for an overview.
                  More specifically: for the MinGW version you use, you have to #include<experimental/filesystem> which is why you get the error.
                  With more recent compilers (e.g. GCC10 or MinGW 11.2), -lstdc++fs is no longer necessary. If the missing linking instruction was the problem, you'd have had a linker rather than a compiler error.
                  BRgds
                  Axel

                  R Offline
                  R Offline
                  rowan Samy
                  wrote on last edited by
                  #11
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • JonBJ JonB

                    @rowan-Samy
                    Since @pingal already wrote

                    I've added QT 6.2.3 along with MinGW 9.0.0 to QT Creator and the problem is solved.

                    what have you done?

                    R Offline
                    R Offline
                    rowan Samy
                    wrote on last edited by
                    #12
                    This post is deleted!
                    JonBJ 1 Reply Last reply
                    0
                    • R rowan Samy

                      This post is deleted!

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

                      @rowan-Samy
                      Seriously?

                      1. Install Qt 6.2.3.
                      2. Install (may come with the Qt version) and use (select as kit) MinGW 9.0.0.
                      3. See whether your problem has gone away.

                      If not then it appears you have a different problem from @pingal so there's no point asking him what he did.

                      1 Reply Last reply
                      0

                      • Login

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