0


I'm migrating from VS2008 to Qt Creator (but still using msvc2008 compiler on Windows) and I have a library (.lib) compiled with VS2008.
Now, in Qt Creator on Windows it doesn't link with my program, I got unresolved externals.
Any idea why is that happening?
I tried to set all compiler flags the same as in Visual Studio (in which it links with no problems). What different compiler flags can cause this? VS compile command:

/Od /I "XXX\inc" /I ".\GeneratedFiles" /I "C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include" /I ".\GeneratedFiles\Debug" /I "C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\qtmain" /I "C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtCore" /I "C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtGui" /I "C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtSql" /I ".\\" /I "XXX\inc" /D "UNICODE" /D "WIN32" /D "QT_LARGEFILE_SUPPORT" /D "QT_CORE_LIB" /D "QT_GUI_LIB" /D "QT_SQL_LIB" /D "QT_PLUGIN" /D "_AFXDLL" /D "_DEBUG" /D "QT_DLL" /D "_WINDLL" /D "_UNICODE" /FD /EHsc /MDd /Yu"preHeader.h" /Fp"XXX\build\XXX\Debug\XXX.pch" /Fo"CXXX\build\XXX\Debug\\" /Fd"XXX\build\XXX\Debug\vc90.pdb" /nologo /c /Zi /TP /errorReport:prompt

Qt Creator compile command:

cl -c -FIpreHeader.h -YupreHeader.h -Fpdebug\XXX_pch.pch -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_LARGEFILE_SUPPORT -DQT_SQL_LIB -DQT_DLL -D_UNICODE -DUNICODE -D_AFXDLL -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DQT_DLL -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtNetwork" -I"c:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtGui" -I"c:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include" -I"..\inc" -I"GeneratedFiles" -I"GeneratedFiles\debug" -I"C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\\include" -I"C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\\include\QtCore" -I"c:\lib\boost_1_48_0" -I"c:\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\ActiveQt" -I"GeneratedFiles\debug" -I"c:\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\win32-msvc2008" -Fodebug\ @XXX\Temp\qrc_resource.obj.1104.11375.jom

Second interesting thing is, in Qt Creator on Linux, the same code, the same project, it links with that library compiled in Visual Studio and resolves those externals.

tweety3d
  • 91
  • 1
  • 4

1 Answers1

0

Found it.
Problem was with... boost version!
Library was compiled with boost 1.38 and it has int32_t defined as "long" where application was built with boost 1.48 and it has int32_t defined as "int".
So symbol exported from library was "long FuncName(...)" where application tried to find "int FuncName(...)" in library and couldn't do it.
Still this is strange, because "int" and "long" are 32 bit on my machine... They should be the same.

Oh, and Linux version has boost in 1.41 which has int32_t defined as "int" so it worked.

tweety3d
  • 91
  • 1
  • 4