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. Creating Libraries on Windows (for Linux Programmers)
Forum Updated to NodeBB v4.3 + New Features

Creating Libraries on Windows (for Linux Programmers)

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 688 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.
  • G Offline
    G Offline
    gaijinpunch
    wrote on last edited by
    #1

    Hi

    I have a project that needs to run on Windows. The caveat is that I'm a Linux guy. The end project will be on Linux but in the interim, it needs to run on both with hopefully no hoops to jump through. Most of my code compiled and ran fine until I made one of my classes a library.

    I compile the project on Windows, and it creates working_dir/debug/MyLibrary.dll. It makes no other file (no .a, not .lib). I'd like these to be loaded statically... doesn't Windows need the .a file for that?

    I am using mingw which comes w/ QtCreator. My firm has Visual Studio but that seems like overkill for this issue. All of my work is done on the Linux side. I'm only pulling the code in and compiling on Windows. The only reason I'm using QtCreator to compile is that it seemed like the easiest way to get qmake going out of the box. I'm lost on a Windows "terminal" to say the least.

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

      If it creates a .dll then it's configured to be built as a dynamic library (dll). If the project is qmake based then you need to add this to the .pro file:
      @
      CONFIG += staticlib
      @
      and re-run qmake. This will configure your project to generate a .lib file (or .a in case of MinGW) that you can statically link to.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gaijinpunch
        wrote on last edited by
        #3

        Thanks, Chris. That worked. I got the static lib, and linking it seemed to work. It may or may not have opened me up to something else though. Before I used any of my own libraries, I was able to compile and run a simple program. After this last compile, it tells me it's missing QtCored.dll. I can probably sort that out though.

        EDIT: Which I did. Thanks again.

        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