PDA

View Full Version : Libraries, problems, external unresolveds..Steps to find the fix



tonnot
27th March 2012, 10:02
I have a third party libs. (msvc10) a MT/MD (Static cfgs's) and dynamic DLL cfg.
I have qt + msvc10 express + win sdk.7

They say that QT can only use this libs on "dynamic configuration" (what is dynamic configuration?)
What it is supossed I have to use ? (I feel as a stupid newbie...)


Ok , I use the existing examples offered, (using the libs) I can't compile ..... I have 4 unresolved external errors of the same lib.
(But I have zero errors for the others)
I have not support for these lib...... (but they are legal, I am a member without rights)

Which are the steps to investigate a possible fix? Where I have to look ?
Thanks.

wysota
27th March 2012, 10:19
Did you tell your compiler you want it to link against this library? What does your Qt project file look like?

tonnot
27th March 2012, 10:55
The project just use the typical LIB +L and -l.
Apparently the other libs can be compiled...
( I say this because If I comment some lib I have 300 errors related to it)


If I use the .dll's I have :
fatal error LNK1107: invalid or corrupt file: cannot read at 0x2B8 ????


So... Have I to use .lib or .dll ?
Thanks....


This is the QT project: (I hope you can view it well )
My 4 errors are related with TD_ExamplesCommon.



TARGET = OdaQtApp
TEMPLATE = app
#TEMPLATE = lib
#CONFIG += plugin # ? for dll

TD_CONF_NAME = vc10dll


win32 {
DESTDIR = ../exe
PRJ_DESTDIR = ""

# http://graphics.ethz.ch/~peterkau/coding.php :
# (see result at project property / C/C++ / Output Files / Program Database File Name)
QMAKE_CXXFLAGS += /Fd$(IntDir)/
#QMAKE_CXXFLAGS_DEBUG and QMAKE_CXXFLAGS_RELEASE

OBJECTS_DIR = $$(PRJ_DESTDIR)build/$$TARGET
MOC_DIR = $$(PRJ_DESTDIR)build/$$TARGET
UI_DIR = $$(PRJ_DESTDIR)build/$$TARGET
RCC_DIR = $$(PRJ_DESTDIR)build/$$TARGET
}

COMMONPATH = ../Common

win32:LIBS += -L/../../../../lib/vc10dll #$$TD_CONF_NAME


INCLUDEPATH += $$COMMONPATH
INCLUDEPATH += C:\\Archivos de programa\\Microsoft SDKs\\Windows\\v7.1\\Samples\\winui\\tsf\\tsfapp
INCLUDEPATH += ../../../Include
INCLUDEPATH += ../../../Extensions/ExServices

HEADERS += ../Common/OdqInterfaces.h
HEADERS += ../Common/ExDynamicModule.h
HEADERS += ../Common/OdqAudit.h
HEADERS += ../Common/OdqClipData.h


!exists( $$(ODADIR)/$$(TD_FLD_NAME)/Include/ExAppServices.h ) {
HEADERS += ../Common/ExAppServices.h
DEFINES += ODA_QT_EX_APP_SERVICES_UNLINKED_RXINIT
}
else {
HEADERS += $$(ODADIR)/$$(TD_FLD_NAME)/Include/ExAppServices.h
}

!exists( $$(ODADIR)/$$(TD_FLD_NAME)/Include/PropServices.h ) {
HEADERS += ../Common/PropServices.h
DEFINES += ODA_QT_PROP_SERVICES_UNLINKED_RXINIT
}
else {
HEADERS += $$(ODADIR)/$$(TD_FLD_NAME)/Include/PropServices.h
}

HEADERS += OdqApplication.h
HEADERS += OdqMainWindow.h
HEADERS += OdqCustomization.h
HEADERS += OdqAppProps.h
HEADERS += OdqPropertyDialog.h
HEADERS += OdqPropertyPalette.h
HEADERS += OdqPlotDialog.h
HEADERS += OdqXmlUtils.h
HEADERS += Services.h
HEADERS += AppModule.h
HEADERS += AppCommands.h
HEADERS += ExAppServicesImpl.h
HEADERS += PropServicesImpl.h
HEADERS += ResBufPropValueBaseConvertors.h

SOURCES += main.cpp
SOURCES += OdqApplication.cpp
SOURCES += OdqMainWindow.cpp
SOURCES += OdqCustomization.cpp
SOURCES += OdqAppProps.cpp
SOURCES += OdqXmlUtils.cpp
SOURCES += OdqPropertyDialog.cpp
SOURCES += OdqPropertyPalette.cpp
SOURCES += OdqPlotDialog.cpp
SOURCES += Services.cpp
SOURCES += AppModule.cpp
SOURCES += AppCommands.cpp
SOURCES += AppPlotCommands.cpp
SOURCES += ExAppServicesImpl.cpp
SOURCES += PropServicesImpl.cpp

# Cryptographic - support for DWG with password
win32 {
# via Window API
INCLUDEPATH += ../../../Extensions/win/Crypt
HEADERS += ../../../Extensions/win/Crypt/WinNTCrypt.h
SOURCES += ../../../Extensions/win/Crypt/WinNTCrypt.cpp
}


exists( $$(ODADIR)/Caustic/OpenRL/Source/OpenRLKey/OpenRLKey.cpp ) {

INCLUDEPATH += $$(ODADIR)/Caustic/OpenRL/Source/OpenRLKey/include
INCLUDEPATH += "$$(ODADIR)/Caustic/OpenRL/ThirdParty/OpenRL_SDK/Include"
HEADERS += $$(ODADIR)/Caustic/OpenRL/Source/OpenRLKey/Include/OpenRLKey.h
HEADERS += $$(ODADIR)/Caustic/OpenRL/Source/OpenRLKey/Include/OpenRLKeyPE.h
HEADERS += $$(ODADIR)/Caustic/OpenRL/Source/OpenRLKey/OpenRLKeyPEImpl.h
SOURCES += $$(ODADIR)/Caustic/OpenRL/Source/OpenRLKey/OpenRLKey.cpp
SOURCES += $$(ODADIR)/Caustic/OpenRL/Source/OpenRLKey/OpenRLKeyPE.cpp

#7051 - TD_OpenRLKey.lib requires linking with Gs
#LIBS += -l$$(TDLIBPREF)Gs
}
else {
DEFINES += ODA_QT_NO_CAUSTIC_OPENRL
}

# QZipReader is private for v 4.5 - 4.6 # TODO use for menu command

QTDIR = C:/QtSDK_ms/QtSources/4.8.0

exists( $$QTDIR/src/gui/text/qzip.cpp ) {

exists( $$QTDIR/include/Qt/private/qzipreader_p.h ) {
#DEFINES += Q_AUTOTEST_EXPORT
#DEFINES -= QT_NO_TEXTODFWRITER
HEADERS += $$QTDIR/include/Qt/private/qzipreader_p.h
HEADERS += $$QTDIR/include/Qt/private/qzipwriter_p.h
INCLUDEPATH += $$QTDIR/src/3rdparty/zlib
SOURCES += $$QTDIR/src/gui/text/qzip.cpp
} else {
# since 4.7.1
INCLUDEPATH += $$QTDIR/src/gui/text
HEADERS += $$QTDIR/src/gui/text/qzipreader_p.h
HEADERS += $$QTDIR/src/gui/text/qzipwriter_p.h
}
}
else {
DEFINES += ODA_QT_NO_QZIP
}

RESOURCES += data/data.qrc

win32 {
RC_FILE = data/OdaQtApp.rc

CONFIG -= embed_manifest_exe
#CONFIG -= embed_manifest_dll
}

CONFIG += qt
QT += xml


# ----- DD set -----

TDLIBPREF = D:/I_DESARROLLO/c++okk/APCdwg/tdvc10dll/lib/vc10dll


DEFINES += UNICODE
DEFINES += _UNICODE
DEFINES += _TOOLKIT_IN_DLL_
DEFINES += $$TDLIBPREF/CLIENT_BUILD
#DEFINES += ADT_DEBUG
#DEFINES += ADT_DYNAMIC_BUILD


LIBS += -l$$TDLIBPREF/TD_Alloc
LIBS += -l$$TDLIBPREF/TD_DbRoot
LIBS += -l$$TDLIBPREF/TD_Root
LIBS += -l$$TDLIBPREF/TD_Db
LIBS += -l$$TDLIBPREF/TD_Ge

##macx {
# LIBS += -l$$(TDLIBPREF)Gi

# # critical for linux :
# TST = $$(TDLIBPREF)
# isEqual(TST, TD_) {
# LIBS += -l$$(TDLIBPREF)SpatialIndex
# }
# else {
# LIBS += -lSpatialIndex
# }

# #LIBS += -l$$(TDLIBPREF)Gs
# #LIBS += -lModelerGeometry
# #LIBS += -l$$(TDLIBPREF)AcisBuilder
# #LIBS += -l$$(TDLIBPREF)Br
# #LIBS += -l$$(TDLIBPREF)BrepRenderer
##}

LIBS += -l$$TDLIBPREF/TD_Key

win32 {
LIBS += -l$$TDLIBPREF/TD_ExamplesCommon
}

Added after 14 minutes:

Maybe with the dependencywalker can I know something interesting.?
Thanks.

wysota
27th March 2012, 11:13
Maybe. The compiler claims your library (.lib) is corrupted.

tonnot
27th March 2012, 11:35
I have the solution.... (I receive help from the owners.)

I link with the .lib's files but also I must to have the .dll's at the same folder than my executable.
But.... I dont understand why it is possible?


It seems that this variable is the guilty:

DEFINES += _TOOLKIT_IN_DLL_

But... I dont understand ....
Static link is not automatic if you use .lib and dynamic if you use dll's ?

Thanks Wy.