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. Can't use functions from Windows.h
Forum Updated to NodeBB v4.3 + New Features

Can't use functions from Windows.h

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 3.4k 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.
  • E Offline
    E Offline
    Engelard
    wrote on 4 Aug 2018, 15:48 last edited by
    #1

    Tried totaly same code in VisualStudio(except stuff inside if/else block, in VS i've simple cout's), can't figure out whats wrong, in VS everything works, when in Qt dummy project from the beginning got 2 errors from those 2 functions:

    alt text

    K A 2 Replies Last reply 4 Aug 2018, 16:29
    0
    • E Engelard
      4 Aug 2018, 15:48

      Tried totaly same code in VisualStudio(except stuff inside if/else block, in VS i've simple cout's), can't figure out whats wrong, in VS everything works, when in Qt dummy project from the beginning got 2 errors from those 2 functions:

      alt text

      K Offline
      K Offline
      koahnig
      wrote on 4 Aug 2018, 16:29 last edited by
      #2

      @Engelard

      Check out your toolchains in creator respectively Kits.
      In creator V4.7 under "Tools"->"Options"->"Kits"
      or previous versions under "Tools"->"Options"->"Build&Run"

      Go through the tabs and search for warning signs.

      Vote the answer(s) that helped you to solve your issue(s)

      E 1 Reply Last reply 4 Aug 2018, 16:34
      0
      • K koahnig
        4 Aug 2018, 16:29

        @Engelard

        Check out your toolchains in creator respectively Kits.
        In creator V4.7 under "Tools"->"Options"->"Kits"
        or previous versions under "Tools"->"Options"->"Build&Run"

        Go through the tabs and search for warning signs.

        E Offline
        E Offline
        Engelard
        wrote on 4 Aug 2018, 16:34 last edited by
        #3

        @koahnig I dont see there any warning signs, just two my Kits

        K 1 Reply Last reply 4 Aug 2018, 16:39
        0
        • E Engelard
          4 Aug 2018, 16:34

          @koahnig I dont see there any warning signs, just two my Kits

          K Offline
          K Offline
          koahnig
          wrote on 4 Aug 2018, 16:39 last edited by
          #4

          @Engelard

          Did you check all tabs?

          My guess is that there is a problem with the compiler setup and the library is missing.

          IIRC the library has to added when you use MinGW, but you are using VS. Therefore, it is a bit out of my recent experience.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • E Engelard
            4 Aug 2018, 15:48

            Tried totaly same code in VisualStudio(except stuff inside if/else block, in VS i've simple cout's), can't figure out whats wrong, in VS everything works, when in Qt dummy project from the beginning got 2 errors from those 2 functions:

            alt text

            A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 4 Aug 2018, 16:47 last edited by
            #5

            Hi @Engelard

            Try adding LIBS += -luser32 in your .pro file.

            Afterwards, run qmake and build again.

            Regards

            Qt has to stay free or it will die.

            E 1 Reply Last reply 4 Aug 2018, 18:51
            5
            • A aha_1980
              4 Aug 2018, 16:47

              Hi @Engelard

              Try adding LIBS += -luser32 in your .pro file.

              Afterwards, run qmake and build again.

              Regards

              E Offline
              E Offline
              Engelard
              wrote on 4 Aug 2018, 18:51 last edited by
              #6

              @aha_1980 said in Can't use functions from Windows.h:

              LIBS += -luser32

              Omg why i have to do such complicated stuff at the first place. Qt devs, pls fix.

              Tnx btw, now there is no error.

              A 1 Reply Last reply 4 Aug 2018, 19:13
              0
              • E Engelard
                4 Aug 2018, 18:51

                @aha_1980 said in Can't use functions from Windows.h:

                LIBS += -luser32

                Omg why i have to do such complicated stuff at the first place. Qt devs, pls fix.

                Tnx btw, now there is no error.

                A Offline
                A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on 4 Aug 2018, 19:13 last edited by
                #7

                @Engelard said in Can't use functions from Windows.h:

                Omg why i have to do such complicated stuff at the first place. Qt devs, pls fix.

                What should be fixed? You are using functions from an external library, so you have to link against it.

                You have to do the same on the other platforms also - pretty standard behavior.

                Regards

                Qt has to stay free or it will die.

                E 1 Reply Last reply 4 Aug 2018, 20:19
                4
                • A aha_1980
                  4 Aug 2018, 19:13

                  @Engelard said in Can't use functions from Windows.h:

                  Omg why i have to do such complicated stuff at the first place. Qt devs, pls fix.

                  What should be fixed? You are using functions from an external library, so you have to link against it.

                  You have to do the same on the other platforms also - pretty standard behavior.

                  Regards

                  E Offline
                  E Offline
                  Engelard
                  wrote on 4 Aug 2018, 20:19 last edited by
                  #8

                  @aha_1980 ok, my mistake then

                  1 Reply Last reply
                  0

                  1/8

                  4 Aug 2018, 15:48

                  • Login

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