Create *.lib instead of *.a



  • hi,
    i have read tons of articles about how to make a static library in qt on windows. but i am confused how to make *.lib

    i have included to *.pro file 2 lines:
    TEMPLATE = lib
    CONFIG += staticlib

    everything is fine, but when i compiled it, it makes only *.a library. and i need *.lib

    can you tell me, what i doing wrong ?? i need *.lib library, because when i have *.a lib, i have to include library as well as its headers files to .pro file. i thing, this is impractical.

    thanks for any advice



  • Actually I think that a .a file created by MinGw should be compatible to a Visual C++ compiler. So I assume you could use the .a like any other static library (.lib) created by a Visual C++ compiler and link it in your project.

    If this proves to be wrong try compiling your library with a Visual C++ compiler as that should usually result in a .lib file.



  • okej, thanks, i think i will use *.a lib.

    another question:
    i have about 10 clases and about 10 header files, is there any possibility to create static library with only one header file?



  • I assume you could cramp all your definitions in one header file but that's really messy and quite not usable for other programmers (and in fact will prove not suitable in time for your self). What I usually do is providing one "entry point" header file that includes all other files that are necessary for accessing the libraries function.

    Of course you'd still have to deploy all header files to the project that is using your library but I think its a reasonable effort to do and using your library will get easier when you provide a "one for all" header file.



  • You dont need to do bq. CONFIG += staticlib

    bq.

    The default is .lib


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.