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. How to use CreateFont API function in Qt5
Forum Updated to NodeBB v4.3 + New Features

How to use CreateFont API function in Qt5

Scheduled Pinned Locked Moved Unsolved General and Desktop
createfont apiwinapi
19 Posts 3 Posters 6.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.
  • Uncle KrisU Uncle Kris

    The program was written using APIs originally. I like to compile and link it before I start to make changes.

    I have tried your solution. Same error.

    kshegunovK Offline
    kshegunovK Offline
    kshegunov
    Moderators
    wrote on last edited by
    #4

    @Uncle-Kris
    Do you have the windows SDKs installed? Did you make sure that the -L switch points to the correct path containing the import library files (.lib) and that you have -lgdi32 in your pro (that's a typo on part of @SGaist as the library is specified with a lowercase letter)?

    Read and abide by the Qt Code of Conduct

    1 Reply Last reply
    0
    • Uncle KrisU Offline
      Uncle KrisU Offline
      Uncle Kris
      wrote on last edited by
      #5

      I see your point. No, SDK is not installed. I used to work in BCB 4 and all basic libraries were part of installation. I will look for them now.

      1 Reply Last reply
      0
      • Uncle KrisU Offline
        Uncle KrisU Offline
        Uncle Kris
        wrote on last edited by
        #6

        I have installed SDK, updated path in .pro file. Same error.

        kshegunovK 1 Reply Last reply
        0
        • Uncle KrisU Uncle Kris

          I have installed SDK, updated path in .pro file. Same error.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #7

          @Uncle-Kris
          Okay, what libraries does the SDK provide (for which compilers), do they match the compiler you're using? Can we see the line from the project where you set the link flags (i.e. LIBS += ...)?

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0
          • Uncle KrisU Offline
            Uncle KrisU Offline
            Uncle Kris
            wrote on last edited by
            #8

            The line is:
            LIBS += -L"H:\Windows Kits\8.1\Lib\winv6.3\um\x86/gdi32"\

            There is no info on compiler dependency. Just folder full of libraries. How I can check?

            kshegunovK 1 Reply Last reply
            0
            • Uncle KrisU Uncle Kris

              The line is:
              LIBS += -L"H:\Windows Kits\8.1\Lib\winv6.3\um\x86/gdi32"\

              There is no info on compiler dependency. Just folder full of libraries. How I can check?

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by kshegunov
              #9

              @Uncle-Kris
              LIBS += -L"H:\Windows Kits\8.1\Lib\winv6.3\um\x86/gdi32"\

              This is incomplete. The backslash at the end means it continues on to the next line. Also, when giving paths, use the forward slash instead of the a backwards. It is recognized on windows and you'll work around a ton of problems with escaping in the long run.

              There is no info on compiler dependency. Just folder full of libraries. How I can check?

              It should be noted somewhere on the MS's site, however I have no windows on hand to check. What compiler are you using currently? The 8.1 SDK should work with MSVC 2012/2013 if I recall correctly.

              Read and abide by the Qt Code of Conduct

              Uncle KrisU 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #10

                @kshegunov Not a typo ;) See here

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                kshegunovK 1 Reply Last reply
                0
                • SGaistS SGaist

                  @kshegunov Not a typo ;) See here

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #11

                  @SGaist said:

                  It would rather be LIBS += -LGdi32.

                  I know, I know. Still looks like you typed -L instead of -l ;)

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    Haaaaaaa that typo ! Good catch ! Then indeed, there was ! :)

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Uncle KrisU 1 Reply Last reply
                    0
                    • kshegunovK kshegunov

                      @Uncle-Kris
                      LIBS += -L"H:\Windows Kits\8.1\Lib\winv6.3\um\x86/gdi32"\

                      This is incomplete. The backslash at the end means it continues on to the next line. Also, when giving paths, use the forward slash instead of the a backwards. It is recognized on windows and you'll work around a ton of problems with escaping in the long run.

                      There is no info on compiler dependency. Just folder full of libraries. How I can check?

                      It should be noted somewhere on the MS's site, however I have no windows on hand to check. What compiler are you using currently? The 8.1 SDK should work with MSVC 2012/2013 if I recall correctly.

                      Uncle KrisU Offline
                      Uncle KrisU Offline
                      Uncle Kris
                      wrote on last edited by
                      #13

                      @kshegunov There was a next line. I have removed it for test time. Also changes to shash/backslash do not make any difference for now. Linker is not happy.

                      1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Haaaaaaa that typo ! Good catch ! Then indeed, there was ! :)

                        Uncle KrisU Offline
                        Uncle KrisU Offline
                        Uncle Kris
                        wrote on last edited by
                        #14

                        @SGaist What typo? Can you be more specific, please? Compiler has no problem with that line. And it used to work in another IDE.

                        Also: "It would rather be LIBS += -LGdi32." No. Without full path there is a message that file is not found. -L and -l makes no difference so far.

                        kshegunovK 1 Reply Last reply
                        0
                        • Uncle KrisU Uncle Kris

                          @SGaist What typo? Can you be more specific, please? Compiler has no problem with that line. And it used to work in another IDE.

                          Also: "It would rather be LIBS += -LGdi32." No. Without full path there is a message that file is not found. -L and -l makes no difference so far.

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #15

                          @Uncle-Kris
                          A library is passed to qmake (respectively make) with the following syntax:

                          LIBS += -L/path/to/library -llibraryname
                          

                          The typo was that @SGaist used the switch for library path -L to specify the library name. It should've been -lgdi32. So in your case it'd look something like this:

                          LIBS += -L"H:/Windows Kits/8.1/Lib/winv6.3/um/x86" -lgdi32
                          

                          Read and abide by the Qt Code of Conduct

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #16

                            Yes the typo was the L vs l but still the library name is Gdi32

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            kshegunovK 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Yes the typo was the L vs l but still the library name is Gdi32

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on last edited by
                              #17

                              @SGaist said:

                              but still the library name is Gdi32

                              The windows linker isn't case sensitive. :)

                              Read and abide by the Qt Code of Conduct

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #18

                                @kshegunov said:

                                @SGaist said:

                                but still the library name is Gdi32

                                The windows linker isn't case sensitive. :)

                                Indeed, but I wouldn't be surprised if that changed at some point :D

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                kshegunovK 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  @kshegunov said:

                                  @SGaist said:

                                  but still the library name is Gdi32

                                  The windows linker isn't case sensitive. :)

                                  Indeed, but I wouldn't be surprised if that changed at some point :D

                                  kshegunovK Offline
                                  kshegunovK Offline
                                  kshegunov
                                  Moderators
                                  wrote on last edited by kshegunov
                                  #19

                                  @SGaist said:

                                  Indeed, but I wouldn't be surprised if that changed at some point :D

                                  Perhaps, perhaps. Although, judging from the time it took MS to introduce the x64 compiler, if it were to change, it'd take decades. And since it hasn't changed for over 30 years, I really doubt that it ever will. :D

                                  Read and abide by the Qt Code of Conduct

                                  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