PDA

View Full Version : Error linking a Win32 lib



Stefano Acerbetti
14th September 2012, 00:58
Hi, I'm pretty new of the QT platform and I think it's great.

I'm starting a project to use the EDSDK (from Canon) and I want to develop it for Win32 and MacOSX.
So far I'm able to compile some simple classes on my Mac, but it's failing to link the link the lib on my WinXP

This is my .pro file



INCLUDEPATH += EDSDK/Header/

win32 {
DEFINES += _WIN32
INCLUDEPATH += $$PWD/EDSDK/Win32/Library
DEPENDPATH += $$PWD/EDSDK/Win32/Library
LIBS += -L$$PWD/EDSDK/Win32/Library/ -lEDSDK
PRE_TARGETDEPS += $$PWD/EDSDK/Win32/Library/EDSDK.lib
}

mac {
DEFINES += __MACOS__
INCLUDEPATH += $$PWD/EDSDK/MacOSX/Framework
DEPENDPATH += $$PWD/EDSDK/MacOSX/Framework
LIBS += -F$$PWD/EDSDK/MacOSX/Framework/ -framework EDSDK
}


and when I'm compiling using VS2008 I'm getting:



16:55:39: Running build steps for project CanonController...
16:55:39: Configuration unchanged, skipping qmake step.
16:55:39: Starting: "D:\QtSDK\QtCreator\bin\jom.exe"
D:\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -D_WIN32 -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\Q tCore" -I"..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\Q tGui" -I"..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include" -I"..\CanonController\EDSDK\Header" -I"..\CanonController\EDSDK\Win32\Library" -I"..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\A ctiveQt" -I"debug" -I"." -I"..\CanonController" -I"." -I"..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\w in32-msvc2008" -Fodebug\ @C:\DOCUME~1\Stefano\LOCALS~1\Temp\cameratablemode l.obj.3656.0.jom
cameratablemodel.cpp
d:\canon\me-canon\canoncontroller\cameratablemodel.h(4) : fatal error C1083: Cannot open type library file: 'd:\qtsdk\desktop\qt\4.8.1\msvc2008\include\qtcore \qabstractlistmodel': Error loading type library/DLL.

mainwindow.cpp
d:\canon\me-canon\canoncontroller\cameratablemodel.h(4) : fatal error C1083: Cannot open type library file: 'd:\qtsdk\desktop\qt\4.8.1\msvc2008\include\qtcore \qabstractlistmodel': Error loading type library/DLL.

Generating Code...

jom 1.0.6 - empower your cores


jom 1.0.6 - empower your cores

command failed with exit code 2
command failed with exit code 2
16:55:41: The process "D:\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
Error while building project CanonController (target: Desktop)
When executing build step 'Make'


Any idea? it looks to me the generated makefile doesn't link the lib


thank you

ChrisW67
14th September 2012, 01:43
The error message indicates that the linker is being told that a header file is a library. This is bad.

What is at/before d:\canon\me-canon\canoncontroller\cameratablemodel.h line 4, or before where that file is included in cameratablemodel.cpp/mainwindow.cpp?

Stefano Acerbetti
14th September 2012, 18:45
8218

this is my simple project, like I said before it does compile on my Mac (not this one since I've stripped out the framework)

I really hope somebody can help, thanks in advance

ChrisW67
14th September 2012, 22:38
Lines 4 and 5 of cameratablemodel.h should read:


#include "EDSDK.h"
#include <QAbstractListModel>

not "#import" which is a Microsoft extension (http://msdn.microsoft.com/en-us/library/8etzzkb6.aspx) related to linking COM libraries not inserting headers. Line 6 of main.cpp has the same problem.

GCC has a deprecated #import pre-processor directive (http://gcc.gnu.org/onlinedocs/gcc-4.3.2/cpp/Obsolete-once_002donly-headers.html) with different meaning (include-once). Objective C has an #import with the same meaning as GCC, which probably explains why it got past the OS X compiler.

Stefano Acerbetti
17th September 2012, 06:30
I knew it was a question for newbie, that fixed all my problems...

thank you so much