Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. LIBS += -lUser32 is no longer working
Forum Updated to NodeBB v4.3 + New Features

LIBS += -lUser32 is no longer working

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
33 Posts 5 Posters 5.5k 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.
  • EngelardE Offline
    EngelardE Offline
    Engelard
    wrote on last edited by
    #1

    For years i was using this line in my .pro file, and it was working fine, Windows.h was available in my projects.

    But now i added new compiler, and it complains that error: 'Windows.h' file not found i searched for many hours and can't find what's wrong...

    1 Reply Last reply
    0
    • jsulmJ jsulm

      @Engelard Just realized: you selected msvc2005 compiler which of course is not compatible with Qt for msvc2017.

      Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #32

      @jsulm He has VS2022 MSVC selected, which is fine for this Qt, but for some reason it detects it as 2005 abi.

      @Engelard I'm not sure why this is happening, but maybe you can workaround it. On the compiler tab select the amd64 compiler, click Clone, select the cloned one and see if you can switch the abi to 2022 in the properties below.
      Btw. it's not related to the issue but you should rename that kit to something more adequate. It's neither a replacement nor x32. Put Qt %{Qt:Version} %{Compiler:Name} in the Name field and it will autogenerate the name based on compiler and Qt build.
      Also, just to make sure you actually have a current MSVC compiler installed (it's an optional component in VS installation) - open Visual Studio Installer, switch to Individual Components tab and see if you have MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) selected there. If not install that.

      EngelardE 1 Reply Last reply
      2
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #2

        Check where 'Windows.h' is located. It is likely its path is changed.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by Chris Kawa
          #3

          One has nothing to do with the other. LIBS += -lUser32 is linking the user32 library available in your System32 directory of Windows installation. Windows.h is a header distributed as part of Windows SDK if you're using MSVC compiler or, if you're using MinGW, in the include directory of its installation. If it can't be found your kit is misconfigured.

          EngelardE 1 Reply Last reply
          3
          • Chris KawaC Chris Kawa

            One has nothing to do with the other. LIBS += -lUser32 is linking the user32 library available in your System32 directory of Windows installation. Windows.h is a header distributed as part of Windows SDK if you're using MSVC compiler or, if you're using MinGW, in the include directory of its installation. If it can't be found your kit is misconfigured.

            EngelardE Offline
            EngelardE Offline
            Engelard
            wrote on last edited by Engelard
            #4

            @Chris-Kawa How exactly misconfigured?
            That day i posted this topic everything was working(excluding Windows.h ofc), even through manually added compilers (year ago i had only auto detected compilers), and now, it gives me plenty of errors and it becomes a bit overwhelming... Here is my new Kits and Compiler screenshots:

            1.JPG

            2.JPG

            P.S. i can't select thouse compilers above that auto detected since then my Kits gives me error, for example:

            3.png

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #5

              First of all why do you have those manual versions added at all? MSVC is automatically detected. You don't need to add it manually.

              Also, you seem to completely mixed up versions and bitness of MSVC compiler and your Qt build. The error at the last screen states this - you have a 64 bit Qt built with VS2019 and you're setting a 32bit VS2005 compiler for that kit. Obviously that won't work. there's also some confusion about your Qt builds - the error on third screen says it's a VS2019 build but the name on the second is Qt 5.12 (msvc 2017). Which is it? Did you name it yourself or is that an autogenerated name? What Qt builds do you have?

              You seem to have an autodetected VS2022 compiler available in both 32bit and 64bit variants., so my advice - remove all the manually added compilers. You don't need them. You have a 64bit VS2019 Qt build, just select the amd64 VS2022 compiler for it and you'll be good to go (VS2019 and VS2022 compilers produce binary compatible code).

              EngelardE 1 Reply Last reply
              1
              • Chris KawaC Chris Kawa

                First of all why do you have those manual versions added at all? MSVC is automatically detected. You don't need to add it manually.

                Also, you seem to completely mixed up versions and bitness of MSVC compiler and your Qt build. The error at the last screen states this - you have a 64 bit Qt built with VS2019 and you're setting a 32bit VS2005 compiler for that kit. Obviously that won't work. there's also some confusion about your Qt builds - the error on third screen says it's a VS2019 build but the name on the second is Qt 5.12 (msvc 2017). Which is it? Did you name it yourself or is that an autogenerated name? What Qt builds do you have?

                You seem to have an autodetected VS2022 compiler available in both 32bit and 64bit variants., so my advice - remove all the manually added compilers. You don't need them. You have a 64bit VS2019 Qt build, just select the amd64 VS2022 compiler for it and you'll be good to go (VS2019 and VS2022 compilers produce binary compatible code).

                EngelardE Offline
                EngelardE Offline
                Engelard
                wrote on last edited by Engelard
                #6

                @Chris-Kawa said in LIBS += -lUser32 is no longer working:

                Did you name it yourself or is that an autogenerated name?

                That one is automatic.

                @Chris-Kawa said in LIBS += -lUser32 is no longer working:

                remove all the manually added compilers

                already did that, and once done that - recalled why i started trying to add that manually. Once i launched Qt creator after 10 months, old auto-detected Kit was broken, i looked at the errors, and it was saying that there is no compilers set in kit, here how it looked like originaly:
                444.JPG

                And every compiler gives an error if i trying to select it. Something like when i choose Mingw:

                555.jpg

                @Chris-Kawa btw thanks for helping me!

                jsulmJ 1 Reply Last reply
                0
                • EngelardE Engelard

                  @Chris-Kawa said in LIBS += -lUser32 is no longer working:

                  Did you name it yourself or is that an autogenerated name?

                  That one is automatic.

                  @Chris-Kawa said in LIBS += -lUser32 is no longer working:

                  remove all the manually added compilers

                  already did that, and once done that - recalled why i started trying to add that manually. Once i launched Qt creator after 10 months, old auto-detected Kit was broken, i looked at the errors, and it was saying that there is no compilers set in kit, here how it looked like originaly:
                  444.JPG

                  And every compiler gives an error if i trying to select it. Something like when i choose Mingw:

                  555.jpg

                  @Chris-Kawa btw thanks for helping me!

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by jsulm
                  #7

                  @Engelard Well, the last pictures shows that you selected 32bit compiler for 64bit Qt. Simply select correct compiler...
                  Also, if you want to build 32bit application you also need 32bit Qt - those are not provided by Qt Company as prebuilt binaries anymore, you will have to build Qt by yourself.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  EngelardE 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Engelard Well, the last pictures shows that you selected 32bit compiler for 64bit Qt. Simply select correct compiler...
                    Also, if you want to build 32bit application you also need 32bit Qt - those are not provided by Qt Company as prebuilt binaries anymore, you will have to build Qt by yourself.

                    EngelardE Offline
                    EngelardE Offline
                    Engelard
                    wrote on last edited by Engelard
                    #8

                    @jsulm said in LIBS += -lUser32 is no longer working:

                    Also, if you want to build 32bit application you also need 32bit Qt

                    i have that as well! Was using both for many years, just forgot that little thing. x32 Qt auto-detected Kits and compiler, and gives same error when i try select Mingw in C++ compiler field:
                    666.jpg

                    jsulmJ 1 Reply Last reply
                    0
                    • EngelardE Engelard

                      @jsulm said in LIBS += -lUser32 is no longer working:

                      Also, if you want to build 32bit application you also need 32bit Qt

                      i have that as well! Was using both for many years, just forgot that little thing. x32 Qt auto-detected Kits and compiler, and gives same error when i try select Mingw in C++ compiler field:
                      666.jpg

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      @Engelard You can't use MinGW compiler with Qt compiled with MSVC compiler! You can't mix different C++ compilers.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      3
                      • Chris KawaC Offline
                        Chris KawaC Offline
                        Chris Kawa
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        @Engelard Just read the error. As @jsulm said you can't mix. Use MSVC compiler for MSVC Qt. Use 32 bit compiler for 32bit build. Use 64bit compiler for 64bit build. There's really nothing more to it.

                        1 Reply Last reply
                        3
                        • EngelardE Offline
                          EngelardE Offline
                          Engelard
                          wrote on last edited by Engelard
                          #11

                          Oh.. Now i feel really dumb, for some reason this "environment setuping" aspect for me was way harder then actual programming.

                          Ah, and one thing changed last year actually. I uninstalled old(probably was like 2019) Visual Studio and installed new 2022, maybe that's the case why it struggle to auto-detect.

                          And i launched Qt creator now, in auto-detected Kit compilers not set, and can't be set because they blocked(grey)

                          UPDATE:

                          I've found that i have such path specified in my environment variables:
                          777.JPG

                          There is no even such folder '2017' actually, and i have VS2022 which is installed on disk :D not :C

                          jsulmJ 1 Reply Last reply
                          0
                          • EngelardE Engelard

                            Oh.. Now i feel really dumb, for some reason this "environment setuping" aspect for me was way harder then actual programming.

                            Ah, and one thing changed last year actually. I uninstalled old(probably was like 2019) Visual Studio and installed new 2022, maybe that's the case why it struggle to auto-detect.

                            And i launched Qt creator now, in auto-detected Kit compilers not set, and can't be set because they blocked(grey)

                            UPDATE:

                            I've found that i have such path specified in my environment variables:
                            777.JPG

                            There is no even such folder '2017' actually, and i have VS2022 which is installed on disk :D not :C

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #12

                            @Engelard You can change your environment variables to point to proper locations.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            EngelardE 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @Engelard You can change your environment variables to point to proper locations.

                              EngelardE Offline
                              EngelardE Offline
                              Engelard
                              wrote on last edited by
                              #13

                              @jsulm Tried that. Did'nt change anything. Still only 4 auto-detected amd-compilers, which i can't use in Kit because field for compilers is grayed out

                              jsulmJ 1 Reply Last reply
                              0
                              • EngelardE Engelard

                                @jsulm Tried that. Did'nt change anything. Still only 4 auto-detected amd-compilers, which i can't use in Kit because field for compilers is grayed out

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #14

                                @Engelard Please show a screen shot of your Kit. Are there any warnings/errors? What exact compilers are shown (please show screen shot of your Compilers tab) and what Kit are you trying to configure (Qt for MinGW or Qt for VSVC?)?

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • Chris KawaC Offline
                                  Chris KawaC Offline
                                  Chris Kawa
                                  Lifetime Qt Champion
                                  wrote on last edited by Chris Kawa
                                  #15

                                  @Engelard Your PATH environment variable looks extremely polluted. There's absolutely no reason to have compilers, libs and even includes (???) in there. That's just asking for problems when all of them from different toolkits are in the same search path. These paths should be set as part of kits in Qt Creator, not globally. Remove any compiler or Qt related directories from your PATH.

                                  Still only 4 auto-detected amd-compilers

                                  There's no such thing as amd compiler. amd64 (or x64) is an architecture.
                                  On your previous screens you have all the compilers you need autodetected:

                                  For 32bit build - Microsoft Visual C++ Compiler 17.0.32112.339 (x86)
                                  For 64bit build - Microsoft Visual C++ Compiler 17.0.32112.339 (amd64)

                                  EngelardE 1 Reply Last reply
                                  2
                                  • Chris KawaC Chris Kawa

                                    @Engelard Your PATH environment variable looks extremely polluted. There's absolutely no reason to have compilers, libs and even includes (???) in there. That's just asking for problems when all of them from different toolkits are in the same search path. These paths should be set as part of kits in Qt Creator, not globally. Remove any compiler or Qt related directories from your PATH.

                                    Still only 4 auto-detected amd-compilers

                                    There's no such thing as amd compiler. amd64 (or x64) is an architecture.
                                    On your previous screens you have all the compilers you need autodetected:

                                    For 32bit build - Microsoft Visual C++ Compiler 17.0.32112.339 (x86)
                                    For 64bit build - Microsoft Visual C++ Compiler 17.0.32112.339 (amd64)

                                    EngelardE Offline
                                    EngelardE Offline
                                    Engelard
                                    wrote on last edited by
                                    #16

                                    @Chris-Kawa said in LIBS += -lUser32 is no longer working:

                                    Remove any compiler or Qt related directories from your PATH.

                                    Done. Nothing changed in Qt Creator.

                                    @Engelard Please show a screen shot

                                    888.JPG

                                    999.JPG

                                    Warning that there is no compiler set).

                                    Screens from x64 Qt creator.

                                    1 Reply Last reply
                                    0
                                    • Chris KawaC Offline
                                      Chris KawaC Offline
                                      Chris Kawa
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #17

                                      Done. Nothing changed in Qt Creator.

                                      Well apparently it has. Now you somehow have two of the same cross compilers (x86_amd64) and no 64bit compiler (amd64). I don't see how this is possible by editing PATH. What did you do exactly?

                                      EngelardE 1 Reply Last reply
                                      1
                                      • Chris KawaC Chris Kawa

                                        Done. Nothing changed in Qt Creator.

                                        Well apparently it has. Now you somehow have two of the same cross compilers (x86_amd64) and no 64bit compiler (amd64). I don't see how this is possible by editing PATH. What did you do exactly?

                                        EngelardE Offline
                                        EngelardE Offline
                                        Engelard
                                        wrote on last edited by Engelard
                                        #18

                                        @Chris-Kawa Just removed from path like 3-4 paths of compiler/VS/Qt related things. Only one of them was recent, which was pointing to the VS2022 compiler directory, other - old/outdated paths of Qt/VS.

                                        Now opened Qt creator, x64 compiler in C++ field is present, 4/4 compilers in both, everything remains the same.

                                        It starts to become really tedious task, i 'm thinking about reinstall everything or something like that. When IDE stop functioning for unknown for me reason - i begin to remember what i hates the most about being the programmer....
                                        But best solution might be just GIVE UP on Microsoft compiler, and try to install some other popular, like GNU.

                                        I'll report here how it went.

                                        1 Reply Last reply
                                        0
                                        • EngelardE Offline
                                          EngelardE Offline
                                          Engelard
                                          wrote on last edited by
                                          #19

                                          Ah... I just find out that GNU compiler is also GCC, and it is also MinGW. For some reason it has many names. And i can't select it for any Kit because it seems like i have x32 version only.

                                          I noticed one little thing which i thought is not important and i decided not mention it, but now i'm wondering. Why this error in Kit appears only when i select C++ compiler, and never rise when i do the same selection for C?
                                          1111.png

                                          1 Reply Last reply
                                          0
                                          • Chris KawaC Offline
                                            Chris KawaC Offline
                                            Chris Kawa
                                            Lifetime Qt Champion
                                            wrote on last edited by
                                            #20

                                            I just find out that GNU compiler is also GCC, and it is also MinGW. For some reason it has many names.

                                            It doesn't, those are different things. GNU is not a compiler. It's a set of free software made for Unix like operating systems. GCC stands for GNU Compiler Collection and it's a set of compilers for multiple languages. It's just one of many elements of the GNU project. MinGW stands for Minimalist GNU for Windows and it's a Windows port of some of the GNU tools, including GCC.

                                            As for your problem. For some reason wrong abi is detected for your compiler. Go to the compilers tab, select the amd64 compiler and see what ABI is detected in the properties below. It should be x86-windows-msvc2022-pe-64bit. If it's not try to click the Remove All button and then Re-detect and check the ABI then.

                                            EngelardE 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