I am trying to create a library for my project. (Qt5, Qt Creator, VS2010 compiler)
I started with a minimal test sample to test how it works.
1-I created a library containing a class with a method
2-I compile it and get the Dll and Lib files
3- In the main application, I add this library and its path to the .pro and verified library successfully.
Now I want to get rid of the DLL and use the lib file as a static library.
So, I added this line to my .pro library file
CONFIG+=staticlib
Now I get the lib file after compilation, but I cannot use it in my project, and I get unresolved external characters ... errors
when I remove CONFIG + = staticlib it works again! but not static.
these are the lines that I added to the .pro file of the main project for loading / linking the library
INCLUDEPATH +="G:/TestLib/testLib" LIBS +=-l"G:/Build/debug/testLib"
So the question is: is it possible to have my own static library in Qt (not a commercial license)?
If so, what's wrong with my approach?
shoud am I changing something in LIBS + = ... to indicate its static library?
I read this article and there seems to be something wrong with my code.
Any help please?
EDIT: problem resolved
The problem was that we did not need Q_DECL_EXPORT and Q_DECL_IMPORT for static libraries! which is not mentioned in this sketchy illusory article.