[solved] *.obj files not found when using msvc
-
Hi,
I am working on a project and I am trying to compile it with the Msvc 2010. It compiles perfectly when using the MinGw compiler, but due to compatibility reasons I have to use Msvc.
When I am building the program all files compile, and the *.obj files are existing.
But afterwards I get some errors like:@PrimaryEmotion.obj:-1: Fehler: LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall AffectiveState::AffectiveState(class AffectiveState const &)" (??0AffectiveState@@QAE@ABV0@@Z)".@
(unresolved symbols) and a hint, that (in this case noted above) the file PrimaryEmotion.obj was not found.
I read in some forums that this might be an error which comes from the linker.
I do not know if this is relevant, but the code compiles to a dll file.Any suggestions what I am doing wrong?
Regards,
Jan -
Hi,
Are you trying to build a MinGW Qt project with Visual Studio ? If so, it won't work, you have to get a matching Qt installed
-
So are you using still using Qt Creator ? Did you setup the compiler and linker correctly ?
And are you sure you are linking to your library correctly ?
-
Yes I am using Qt Creator with "Qt 5.2.0 MSVC2010 32bit OpenGL" and the "msvc 10 x86" compiler. I am pretty shure this is correct, because the compilation does not fail, but the linking.
A am not linking agains any library outside of the project. The linking errors come from *.obj files which are not found, but are compiled from within the project.
As I said the project compiles fine with MinGW so this might be a msvc issue. Any msvc specific stuff that I do not see in the documentation.
For clearance here the complete compiler output.
@01:16:22: Führe Schritte für Projekt WASABIEngine aus...
01:16:22: Starte "C:\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\bin\qmake.exe" C:\Users\Mortl\Desktop\WASABIQtGui\WASABIEngine\WASABIEngine.pro -r -spec win32-msvc2010
01:16:23: Der Prozess "C:\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\bin\qmake.exe" wurde normal beendet.
01:16:23: Starte "C:\Qt\Qt5.2.0\Tools\QtCreator\bin\jom.exe"
C:\Qt\Qt5.2.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DWASABIENGINE_LIBRARY -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -I"..........\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\include" -I"..........\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\include\QtCore" -I"release" -I"." -I"..........\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\Mortl\AppData\Local\Temp\WASABIRunner.obj.2992.15.jom
WASABIRunner.cc
WASABIEngine.cc
SecondaryEmotion.cc
PrimaryEmotion.cc
EmotionDynamics.cc
Code wird generiert...
cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DWASABIENGINE_LIBRARY -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -I"..........\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\include" -I"..........\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\include\QtCore" -I"release" -I"." -I"..........\Qt\Qt5.2.0\5.2.0\msvc2010_opengl\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\Mortl\AppData\Local\Temp\EmotionConverter.obj.2992.15.jom
EmotionConverter.cc
EmotionContainer.cc
cogaEmotionalAttendee.cc
cogaAttendee.cc
AffectiveState.cc
Code wird generiert...
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /MANIFEST /MANIFESTFILE:release\WASABIEngine.dll.embed.manifest /OUT:release\WASABIEngine.dll @C:\Users\Mortl\AppData\Local\Temp\WASABIEngine.dll.2992.7593.jom
Bibliothek "release\WASABIEngine.lib" und Objekt "release\WASABIEngine.exp" werden erstellt.
SecondaryEmotion.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall AffectiveState::AffectiveState(class AffectiveState const &)" (??0AffectiveState@@QAE@ABV0@@Z)" in Funktion ""public: __thiscall SecondaryEmotion::SecondaryEmotion(class SecondaryEmotion const &)" (??0SecondaryEmotion@@QAE@ABV0@@Z)".
PrimaryEmotion.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall AffectiveState::AffectiveState(class AffectiveState const &)" (??0AffectiveState@@QAE@ABV0@@Z)".
EmotionContainer.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""public: __thiscall AffectiveState::AffectiveState(class AffectiveState const &)" (??0AffectiveState@@QAE@ABV0@@Z)".
release\WASABIEngine.dll : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.
jom: C:\Users\Mortl\Desktop\WASABIQtGui\build-WASABIEngine\Makefile.Release [release\WASABIEngine.dll] Error 1120
jom: C:\Users\Mortl\Desktop\WASABIQtGui\build-WASABIEngine\Makefile [release] Error 2
01:16:30: Der Prozess "C:\Qt\Qt5.2.0\Tools\QtCreator\bin\jom.exe" wurde mit dem Rückgabewert 2 beendet.
Fehler beim Erstellen/Deployment des Projekts WASABIEngine(Kit: Desktop Qt 5.2.0 MSVC2010 32bit OpenGL)
Bei der Ausführung von Schritt 'Make'
01:16:30: Verstrichene Zeit: 00:08.@ -
-
Indeed, gcc and msvc (also clang) have different sensitivities about such things (also e.g. order of initialization)
Great you found and and thanks for sharing !
Can you also update the thread title prepending [solved] ? So other forum users may know a solution has been found :)