Win32 qmake: building a static library
Hi,
Another question... (I'm new to Qt and qmake). I have the following .pro file (listed below), and I'm using qmake to generate a makefile. I want to build a Win32 static library (with MinGW) (e.g. <name>.lib) but I get a Unix library built (e.g. lib<name>.a).
The relevant environment variables are:
QMAKESPEC=win32-g++
QTDIR=C:\Qt\4.2.1
and MinGW and Qt are both in my PATH.
Any ideas?
Thanks,
Amanda
TEMPLATE = lib
TARGET = tktabwidget
DESTDIR = ..
CONFIG += qt warn_on thread dll staticlib debug
CONFIG -= release
#CONFIG += qt warn_on thread staticlib release
win32{
CONFIG -= flat
}
debug{
UI_DIR=.debug/ui
MOC_DIR=.debug/moc
OBJECTS_DIR=.debug/obj
}
release{
UI_DIR=.release/ui
MOC_DIR=.release/moc
OBJECTS_DIR=.release/obj
}
INCLUDEPATH += .\
../tkdock
SOURCES += \
tktabbar.cpp \
tktabwidget.cpp
HEADERS += \
tktabbar.h \
tktabwidget.h
QT += qt3support
QT += xml
Re: Win32 qmake: building a static library
Quote:
Originally Posted by
Amanda
but I get a Unix library built (e.g. lib<name>.a).
That's how MinGW names libraries. If you want .lib file, try this: http://www.mingw.org/mingwfaq.shtml#faq-msvcdll
Re: Win32 qmake: building a static library
Thank you for your reply. However, msvcdll builds a dll for Microsoft Visual C++. I don't want to build a dynamic library, I'm building a static library. Also, I'm using Eclipse with MinGW not Microsoft Visual C++.
I thought lib<name>.a is the naming convention for a static library on Unix. Therefore, I assumed I am not building my library correctly on a Win32 platform - is that assumption correct?
Thanks,
Amanda
Re: Win32 qmake: building a static library
Quote:
Originally Posted by
Amanda
I thought lib<name>.a is the naming convention for a static library on Unix.
Yes, it is, but MinGW uses the same naming scheme for import libraries too.
Re: Win32 qmake: building a static library
So the build was successful, and I can just rename lib<name>.a to <name>.lib?
Amanda
Re: Win32 qmake: building a static library
Quote:
Originally Posted by
Amanda
So the build was successful, and I can just rename lib<name>.a to <name>.lib?
If you want to use that library in MinGW, you don't have to do anything, and if you want to use it in a program compiled with MSVC, you shouldn't, since MinGW isn't binary compatible with MSVC and it just won't work.