Q:

Qt shared library in windows, not generating .lib file

I have a simple class (the analog clock from the Qt examples) that I want as a test to compile into a shared library. So what I want in the end is to have a .dll file and a .lib file. 
What I did was simply create a new project, add the analog clock header and source file and then configure TEMPLATE = lib in the pro file.
Yet this only creates a .dll file and the article I found on the docs is not very helpful.
Does anyone know how can I solve this, and end up with both the dll and lib files?
EDIT 1
After doing this 
#if defined(TEST)
#define AnalogClockPlug Q_DECL_EXPORT
#else
#define AnalogClockPlug Q_DECL_IMPORT
#endif

and then simply adding AnalogClockPlug in front of my main class and defining TEST in my pro file, qt generated a lib file. 
Yet I am not sure I understand why exactly, or even if it is correct.

A:

Q_DECL_EXPORT is just the same (under Windows) as __declspec(dllexport) pragma. It makes all the methods of your class to go to the dll 'exports' table (a special section in dll binary file).
Lib utility just reads the dll exports, and produces what is called 'the import library' - it's not like a usual static lib, containing actual code, but just a bunch of records stating that 'such procedure name' is to be found in 'such dll name'.
If you don't have that pragma, your dll exports table is empty, and lib utility refuses to output empty lib file. That's all.

