Unsolved .pro file creates only dll - how do i build a lib too?
-
Hi All,
When building the next .pro file it produces only .dll file, How can i get a .lib file too(On windows platform) ?
What am i missing ?
Thanks,
#-------------------------------------------------
Project created by QtCreator 2016-10-14T03:25:26
#-------------------------------------------------
QT -= gui
TARGET = LoggerLib
TEMPLATE = lib
CONFIG += debugHEADERS += logger.h
win32 {
message(Build win32 LoggerLib)message(pwd=$$PWD) contains(QMAKE_HOST.arch, X86_64) { QMAKE_LFLAGS += /MACHINE:X64 } else { QMAKE_LFLAGS += /MACHINE:X86 QMAKE_LFLAGS += /NOENTRY } release:QMAKE_CXXFLAGS += /MT QMAKE_CXXFLAGS += /MTd QMAKE_CXXFLAGS_DEBUG += /MTd QMAKE_CXXFLAGS_RELEASE += /MT CONFIG(debug, debug|release){ DESTDIR = $$_PRO_FILE_PWD_/../Debug OBJECTS_DIR = $$_PRO_FILE_PWD_/../Debug MOC_DIR = $$_PRO_FILE_PWD_/../Debug RCC_DIR = $$_PRO_FILE_PWD_/../Debug } win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/release/ -llog4cxx else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/Debug/ -llog4cxx INCLUDEPATH += $$PWD/../../../TcpComp\3rdParty\log4cxx\log4cxx\src\main\include DEPENDPATH += $$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/Debug
}
-
@nirh
what compiler are you using? MSVC?Are your lib exporting symbols? If not there is no .lib file created.
-
Hi @raven-worx,
I am a Linux programer, But according to your Question, I dont think that my Lib exports any symbols,
However the reason i thought that the .pro should produce a lib file is because i had another .pro file that is lookin to link with thge above lib.How can i tell the next .pro file to use a dll insted?
Thanks
-
Hi,
You are likely having a static library on one hand and a dynamic one on the other. In any case, export the symbols of your library properly and should be good to go. Here how to do it.
-
Hi @SGaist,
I cannot add the Q_DECL_EXPORT or Q_DECL_IMPORT because i am linking to a third party code ( i just use a header with MACROS to that third party library),
Maybe i need to link to the dll it creats, But the lib i linking with always conflicts eith the machine type,
LNK1112: module machine type 'x64' conflicts with target machine type 'X86' ?
Any idea please ?
Thanks,
Nirh
-
Hi
Its solved by adding:
CONFIG += staticlibThanks,
Nirh
-
You can also simply write your own macros based on Q_DECL_XXX if you don't want Qt stuff in your header.
You were trying to link a 64bit build of your library with a 32bit target.