I am trying to upgrade my Qt-project settings from Visual Studio 2013 to 2015. It almost done but I get some errors with qtmaind.lib.
1>qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external
symbol imp__RoInitialize#4 referenced in function _WinMain#16
1>qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external
symbol __imp__RoGetActivationFactory#12 referenced in function
"public: __thiscall AppContainer::AppContainer(void)"
(??0AppContainer##QAE#XZ) 1>qtmaind.lib(qtmain_winrt.obj) : error
LNK2019: unresolved external symbol _WindowsCreateStringReference#16
referenced in function "private: void __thiscall
Microsoft::WRL::Wrappers::HStringReference::CreateReference(wchar_t
const *,unsigned int,unsigned int)"
(?CreateReference#HStringReference#Wrappers#WRL#Microsoft##AAEXPB_WII#Z)
1>qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external
symbol _WindowsDeleteString#4 referenced in function "public: void
__thiscall Microsoft::WRL::Wrappers::HString::Release(void)" (?Release#HString#Wrappers#WRL#Microsoft##QAEXXZ)
1>qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external
symbol _WindowsGetStringRawBuffer#8 referenced in function "public:
wchar_t const * __thiscall
Microsoft::WRL::Wrappers::HString::GetRawBuffer(unsigned int *)const "
(?GetRawBuffer#HString#Wrappers#WRL#Microsoft##QBEPB_WPAI#Z)
1>qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external
symbol _RoOriginateError#8 referenced in function "public: static void
__cdecl Microsoft::WRL::ErrorHelper<0>::OriginateError(long,struct HSTRING *)"
(?OriginateError#?$ErrorHelper#$0A##WRL#Microsoft##SAXJPAUHSTRING__###Z)
Qt 5.6-rc (22-Feb-2016 15:11)
link to WindowsApp.lib. That should resolve your issues.
At least for getting GetActivationFactory, you need to link to runtimeobject.lib.
Related
Note: This is the second part of the problem I'm facing. The first part is here.
I'm not sure how I got to this problem, but the other part is these four:
main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl cm::controllers::MasterController::metaObject(void)const " (?metaObject#MasterController#controllers#cm##UEBAPEBUQMetaObject##XZ)
,
main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __cdecl cm::controllers::MasterController::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#MasterController#controllers#cm##UEAAHW4Call#QMetaObject##HPEAPEAX#Z)
,
main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __cdecl cm::controllers::MasterController::qt_metacast(char const *)" (?qt_metacast#MasterController#controllers#cm##UEAAPEAXPEBD#Z)
and finally,
main.obj:-1: error: LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct QMetaObject const cm::controllers::MasterController::staticMetaObject" (__imp_?staticMetaObject#MasterController#controllers#cm##2UQMetaObject##B)
Something I found while searching on this was that I could get rid of all of these through removing Q_OBJECT, saving, then putting it back. For me, it only went away when I removed Q_OBJECT without putting it back. This definitely isn't a solution, just something interesting I found.
I'm using Qt Creator 5.12, by the way.
I am building opencv 4.3.0 in the windows-vs2015, using cmake3.17.3, with WITH_QT enabled. Here are errors messages related to opencv_contrib module cvv in the building process:
Creating library C:/opencv/opencv-4.3.0-cbuild/lib/Release/opencv_world430.lib and object C:/opencv/opencv-4.3.0-cbuild/lib/Release/opencv_world430.exp
view_controller.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl cvv::gui::CallTab::metaObject(void)const " (?metaObject#CallTab#gui#cvv##UEBAPEBUQMetaObject##XZ)
image_call_tab.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl cvv::gui::CallTab::metaObject(void)const " (?metaObject#CallTab#gui#cvv##UEBAPEBUQMetaObject##XZ)
view_controller.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl cvv::gui::CallTab::qt_metacast(char const *)" (?qt_metacast#CallTab#gui#cvv##UEAAPEAXPEBD#Z)
image_call_tab.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl cvv::gui::CallTab::qt_metacast(char const *)" (?qt_metacast#CallTab#gui#cvv##UEAAPEAXPEBD#Z)
view_controller.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl cvv::gui::CallTab::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#CallTab#gui#cvv##UEAAHW4Call#QMetaObject##HPEAPEAX#Z)
image_call_tab.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl cvv::gui::CallTab::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#CallTab#gui#cvv##UEAAHW4Call#QMetaObject##HPEAPEAX#Z)
view_controller.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject
.........
C:\opencv\opencv-4.3.0-cbuild\bin\Release\opencv_world430.dll : fatal error LNK1120: 226 unresolved externals
What is the problem with these errors? I googled online and found some similar posts (https://answers.opencv.org/question/210338/build-error-when-activating-both-cvv-and-world/; Linking errors for Qt and cvv when building OpenCV in Windows 10). It seems that BUILD_opencv_world, WITH_QT and Build_opencv_cvv cannot be activated simultaneously for building. Should I need to remove the cvv module from the opencv_contrib folder?
I'm having problems building Qt 5.5 from the Git Source.
Does anyone know what is causing this and how to solve it?
I've been following these steps.
http://doc.qt.io/qt-5/windows-building.html
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QPlaceDetailsR
eplyUnsupported::metaObject(void)const " (?metaObject#QPlaceDetailsReplyUnsupported##UBEPBUQMetaObject##XZ)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QPlaceDetailsReplyUnsupported::qt_
metacast(char const *)" (?qt_metacast#QPlaceDetailsReplyUnsupported##UAEPAXPBD#Z)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QPlaceDetailsReplyUnsupported::qt_met
acall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QPlaceDetailsReplyUnsupported##UAEHW4Call#QMetaObject##HPAPAX#Z)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QPlaceContentR
eplyUnsupported::metaObject(void)const " (?metaObject#QPlaceContentReplyUnsupported##UBEPBUQMetaObject##XZ)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QPlaceContentReplyUnsupported::qt_
metacast(char const *)" (?qt_metacast#QPlaceContentReplyUnsupported##UAEPAXPBD#Z)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QPlaceContentReplyUnsupported::qt_met
acall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QPlaceContentReplyUnsupported##UAEHW4Call#QMetaObject##HPAPAX#Z)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QPlaceSearchSu
ggestionReplyUnsupported::metaObject(void)const " (?metaObject#QPlaceSearchSuggestionReplyUnsupported##UBEPBUQMetaObject##XZ)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QPlaceSearchSuggestionReplyUnsuppo
rted::qt_metacast(char const *)" (?qt_metacast#QPlaceSearchSuggestionReplyUnsupported##UAEPAXPBD#Z)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QPlaceSearchSuggestionReplyUnsupporte
d::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QPlaceSearchSuggestionReplyUnsupported##UAEHW4Call#QMetaObject##HPAPAX#Z)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QPlaceMatchRep
lyUnsupported::metaObject(void)const " (?metaObject#QPlaceMatchReplyUnsupported##UBEPBUQMetaObject##XZ)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QPlaceMatchReplyUnsupported::qt_me
tacast(char const *)" (?qt_metacast#QPlaceMatchReplyUnsupported##UAEPAXPBD#Z)
qplacemanagerengineosm.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QPlaceMatchReplyUnsupported::qt_metac
all(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QPlaceMatchReplyUnsupported##UAEHW4Call#QMetaObject##HPAPAX#Z)
F:\Code\qt5\qtbase\plugins\geoservices\qtgeoservices_osm.dll : fatal error LNK1120: 12 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
I’m trying to compile my first Qt project, but I have problems with unresolved extrnals when I link it. This is the full error log: http://pastebin.com/KpjvFKfu
Qt5Gui.lib(qdrawhelper_sse2.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
Qt5Gui.lib(qdrawhelper_avx.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
Qt5Gui.lib(qdrawhelper_ssse3.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
Qt5Gui.lib(Qt5Gui_pch.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
Qt5Gui.lib(qimage_avx.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
Qt5Gui.lib(qimage_sse2.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
Qt5Gui.lib(qimage_ssse3.obj) : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
main.obj : error LNK2001: unresolved external symbol "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map#std##YAPBDH#Z)
.....
I'm using Qt compiled with VS2012 ×86 (compiled with -MT parameter). My program is also compiled with the same compiler and linked statically. I link with these Qt-related libraries: Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib qtmain.lib
Do I need some more libraries to include or are there some other dependencies which I missed? How can I fix these errors?
I wrote a small image processing algorithm using the CImg library and bundled it in a command line application using Visual C++ Express. Everything compiled error free and ran well, until the engineer in charge of the project decided he wanted a GUI. So I went to Qt and Qt creator. The GUI functioned fine by itself, but all hell breaks loose when I move my image processing algorithm over.
mainwindow.obj : error LNK2019: unresolved external
symbol__imp__SHGetSpecialFolderPathA#16 referenced in function "char const * __cdecl
cimg_library::cimg::programfiles_path(char const * const,bool)"
(?programfiles_path#cimg#cimg_library##YAPBDQBD_N#Z)
mainwindow.obj : error LNK2019: unresolved external symbol
__imp__EnumDisplaySettingsW#12 referenced in function "public: static int __cdecl
cimg_library::CImgDisplay::screen_width(void)"
(?screen_width#CImgDisplay#cimg_library##SAHXZ)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow#4
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall
cimg_library::CImgDisplay::assign(void)"
(?assign#CImgDisplay#cimg_library##QAEAAU12#XZ)
mainwindow.obj : error LNK2019: unresolved external symbol
__imp__ChangeDisplaySettingsW#8 referenced in function "public: void __thiscall
cimg_library::CImgDisplay::_desinit_fullscreen(void)"
(?_desinit_fullscreen#CImgDisplay#cimg_library##QAEXXZ)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__SetWindowPos#28
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall
cimg_library::CImgDisplay::resize(int,int,bool)"
(?resize#CImgDisplay#cimg_library##QAEAAU12#HH_N#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__AdjustWindowRect#12
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall
cimg_library::CImgDisplay::resize(int,int,bool)"
(?resize#CImgDisplay#cimg_library##QAEAAU12#HH_N#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageW#4
referenced in function "public: static unsigned long __stdcall
cimg_library::CImgDisplay::_events_thread(void *)"
(?_events_thread#CImgDisplay#cimg_library##SGKPAX#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__GetMessageW#16
referenced in function "public: static unsigned long __stdcall
cimg_library::CImgDisplay::_events_thread(void *)"
(?_events_thread#CImgDisplay#cimg_library##SGKPAX#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__SetWindowLongW#12
referenced in function "public: static unsigned long __stdcall
cimg_library::CImgDisplay::_events_thread(void *)"
(?_events_thread#CImgDisplay#cimg_library##SGKPAX#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__GetDC#4 referenced
in function "public: static unsigned long __stdcall
cimg_library::CImgDisplay::_events_thread(void *)"
(?_events_thread#CImgDisplay#cimg_library##SGKPAX#Z)
mainwindow.obj : error LNK2019: unresolved external symbol
__imp__SetForegroundWindow#4 referenced in function "public: static unsigned long
__stdcall cimg_library::CImgDisplay::_events_thread(void *)"
(?_events_thread#CImgDisplay#cimg_library##SGKPAX#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__GetWindowRect#8
referenced in function "public: static unsigned long __stdcall
cimg_library::CImgDisplay::_events_thread(void *)"
(?_events_thread#CImgDisplay#cimg_library##SGKPAX#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA#48
referenced in function "public: static unsigned long __stdcall
cimg_library::CImgDisplay::_events_thread(void *)"
(?_events_thread#CImgDisplay#cimg_library##SGKPAX#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcW#16
referenced in function "public: static long __stdcall
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned
int,long)" (?_handle_events#CImgDisplay#cimg_library##SGJPAUHWND__##IIJ#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__ShowCursor#4
referenced in function "public: static long __stdcall
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned
int,long)" (?_handle_events#CImgDisplay#cimg_library##SGJPAUHWND__##IIJ#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__TrackMouseEvent#4
referenced in function "public: static long __stdcall
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned
int,long)" (?_handle_events#CImgDisplay#cimg_library##SGJPAUHWND__##IIJ#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__PeekMessageW#20
referenced in function "public: static long __stdcall
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned
int,long)" (?_handle_events#CImgDisplay#cimg_library##SGJPAUHWND__##IIJ#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__ShowWindow#8
referenced in function "public: static long __stdcall
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned
int,long)" (?_handle_events#CImgDisplay#cimg_library##SGJPAUHWND__##IIJ#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__GetWindowLongW#8
referenced in function "public: static long __stdcall
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned
int,long)" (?_handle_events#CImgDisplay#cimg_library##SGJPAUHWND__##IIJ#Z)
mainwindow.obj : error LNK2019: unresolved external symbol __imp__SetDIBitsToDevice#48
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall
cimg_library::CImgDisplay::paint(void)" (?paint#CImgDisplay#cimg_library##QAEAAU12#XZ)
debug\final.exe : fatal error LNK1120: 20 unresolved externals
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
\BIN\nmake.exe"' : return code '0x2'
Stop.
My problem now, is I have no idea why I'm having linker trouble. The CImg library is a single H file. It's part of the project and included. I know Qt Creator needs libraries added to the project file, but what is there to add? My library is already listed under headers.
Here is the project file.
QT += core gui
TARGET = final
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h \
C:/includes/CImg.h
FORMS += mainwindow.ui
INCLUDEPATH += C:\includes\
Thanks for the assistance, I'm primarily an embedded systems programmer, and working out of my C and assembly element is getting very frustrating.
You need to link the Cimg library to you GUI program. Add the library in your .pro file.
LIBS += -L$PATH_TO_CIMG_LIB -l$CIMG_LIB
try compiling the cimg header file to a static library
and use (libs+=...youtstaticlibrary) i use visual studio so i cant help you how to add library's to qt , figure that out your self.
steps to compile to static library
eg. create CIMG_LIB project(console project) (or any name you like)
and in your source file include cimg header.
use namespace cimg_library in source code ( dont add anything else here )
compile the project to static library
--> create GUI project with qt
include header file in your project
add library that you previously created..
and ur good to go.