Hi All,
I'll try and be succinct. I have an engine project which is made up of two QProjects. The engine 'runtime' builds as a static library which is the editor then links against in addition to using SFML itself (drawing into a QWidget for the viewport). I've recently been trying to link SFML statically in an attempt to simplify the process of actually getting a functioning binary.
Here is the SFML-specifics of my 'runtime' QProject file:
# SFML
DEFINES += SFML_STATIC
INCLUDEPATH += "$$PWD/../ThirdParty/SFML/include"
DEPENDPATH += "$$PWD/../ThirdParty/SFML/include"
LIBS += -L"$$PWD/../ThirdParty/SFML/lib"
CONFIG(release, debug|release):
{
#SFML-System Libs
LIBS += -lsfml-system-s #SFML Static Module
LIBS += -lwinmm #Dependency
#SFML-Window Libs
LIBS += -lsfml-window-s #SFML Static Module
LIBS += -lsfml-system-s #
LIBS += -lopengl32 #Dependency
LIBS += -lgdi32 #Dependency
LIBS += -lwinmm #Dependency
#Audio Related Libs
LIBS += -lsfml-audio-s #SFML Static Module
LIBS += -lsfml-system-s #
LIBS += -lopenal32 #Dependency
LIBS += -lFLAC #Dependency
LIBS += -lvorbisenc #Dependency
LIBS += -lvorbisfile #Dependency
LIBS += -lvorbis #Dependency
LIBS += -logg #Dependency
#SFML-Graphics Libs
LIBS += -lsfml-graphics-s #SFML Static Module
LIBS += -lsfml-window-s #
LIBS += -lsfml-system-s #
LIBS += -lfreetype #Dependency
}
The editor QProject file also has the same SFML-specifics in it so I won't duplicate it needlessly.
Anyway, the errors come when attempting to build the editor (the runtime builds fine, without issue - though I appreciate the error could be in the runtime and is simply manifesting when I try to build the editor):
sfml-window-s.lib(CursorImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function "public: bool __thiscall sf::priv::CursorImpl::loadFromPixels(unsigned char const *,class sf::Vector2<unsigned int>,class sf::Vector2<unsigned int>)" (?loadFromPixels@CursorImpl@priv@sf@@QAE_NPBEV?$Vector2@I@3@1@Z)
sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__GetDC@4
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2001: unresolved external symbol __imp__GetDC@4
sfml-window-s.lib(CursorImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__ReleaseDC@8 referenced in function "public: bool __thiscall sf::priv::CursorImpl::loadFromPixels(unsigned char const *,class sf::Vector2<unsigned int>,class sf::Vector2<unsigned int>)" (?loadFromPixels@CursorImpl@priv@sf@@QAE_NPBEV?$Vector2@I@3@1@Z)
sfml-window-s.lib(WglContext.cpp.obj) : error LNK2001: unresolved external symbol __imp__ReleaseDC@8
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2001: unresolved external symbol __imp__ReleaseDC@8
sfml-window-s.lib(CursorImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function "public: bool __thiscall sf::priv::CursorImpl::loadFromSystem(enum sf::Cursor::Type)" (?loadFromSystem@CursorImpl@priv@sf@@QAE_NW4Type@Cursor@3@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2001: unresolved external symbol __imp__LoadCursorW@8
sfml-window-s.lib(CursorImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__DestroyCursor@4 referenced in function "public: __thiscall sf::priv::CursorImpl::~CursorImpl(void)" (??1CursorImpl@priv@sf@@QAE@XZ)
sfml-window-s.lib(CursorImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__CreateIconIndirect@4 referenced in function "public: bool __thiscall sf::priv::CursorImpl::loadFromPixels(unsigned char const *,class sf::Vector2<unsigned int>,class sf::Vector2<unsigned int>)" (?loadFromPixels@CursorImpl@priv@sf@@QAE_NPBEV?$Vector2@I@3@1@Z)
sfml-window-s.lib(CursorImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__CopyIcon@4 referenced in function "public: bool __thiscall sf::priv::CursorImpl::loadFromSystem(enum sf::Cursor::Type)" (?loadFromSystem@CursorImpl@priv@sf@@QAE_NW4Type@Cursor@3@@Z)
sfml-window-s.lib(VideoModeImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplaySettingsW@12 referenced in function "public: static class sf::VideoMode __cdecl sf::priv::VideoModeImpl::getDesktopMode(void)" (?getDesktopMode@VideoModeImpl@priv@sf@@SA?AVVideoMode@3@XZ)
sfml-window-s.lib(WglContext.cpp.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "private: void __thiscall sf::priv::WglContext::createSurface(class sf::priv::WglContext *,unsigned int,unsigned int,unsigned int)" (?createSurface@WglContext@priv@sf@@AAEXPAV123@III@Z)
sfml-window-s.lib(WglContext.cpp.obj) : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "public: virtual __thiscall sf::priv::WglContext::~WglContext(void)" (??1WglContext@priv@sf@@UAE@XZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2001: unresolved external symbol __imp__DestroyWindow@4
sfml-window-s.lib(WglContext.cpp.obj) : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "private: void __thiscall sf::priv::WglContext::createSurface(class sf::priv::WglContext *,unsigned int,unsigned int,unsigned int)" (?createSurface@WglContext@priv@sf@@AAEXPAV123@III@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2001: unresolved external symbol __imp__ShowWindow@8
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__TrackMouseEvent@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::cleanup(void)" (?cleanup@WindowImplWin32@priv@sf@@AAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function "protected: virtual void __thiscall sf::priv::WindowImplWin32::processEvents(void)" (?processEvents@WindowImplWin32@priv@sf@@MAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function "protected: virtual void __thiscall sf::priv::WindowImplWin32::processEvents(void)" (?processEvents@WindowImplWin32@priv@sf@@MAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageW@20 referenced in function "protected: virtual void __thiscall sf::priv::WindowImplWin32::processEvents(void)" (?processEvents@WindowImplWin32@priv@sf@@MAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__SendMessageW@16 referenced in function "public: virtual void __thiscall sf::priv::WindowImplWin32::setIcon(unsigned int,unsigned int,unsigned char const *)" (?setIcon@WindowImplWin32@priv@sf@@UAEXIIPBE@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__RegisterDeviceNotificationW@12 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function "private: static long __stdcall sf::priv::WindowImplWin32::globalOnEvent(struct HWND__ *,unsigned int,unsigned int,long)" (?globalOnEvent@WindowImplWin32@priv@sf@@CGJPAUHWND__@@IIJ@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__CallWindowProcW@20 referenced in function "private: static long __stdcall sf::priv::WindowImplWin32::globalOnEvent(struct HWND__ *,unsigned int,unsigned int,long)" (?globalOnEvent@WindowImplWin32@priv@sf@@CGJPAUHWND__@@IIJ@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__RegisterClassW@4 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__UnregisterClassW@8 referenced in function "public: virtual __thiscall sf::priv::WindowImplWin32::~WindowImplWin32(void)" (??1WindowImplWin32@priv@sf@@UAE@XZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__FlashWindowEx@4 referenced in function "public: virtual void __thiscall sf::priv::WindowImplWin32::requestFocus(void)" (?requestFocus@WindowImplWin32@priv@sf@@UAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__SetWindowPos@28 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetKeyState@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::processEvent(unsigned int,unsigned int,long)" (?processEvent@WindowImplWin32@priv@sf@@AAEXIIJ@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__MapVirtualKeyW@8 referenced in function "private: static enum sf::Keyboard::Key __cdecl sf::priv::WindowImplWin32::virtualKeyCodeToSF(unsigned int,long)" (?virtualKeyCodeToSF@WindowImplWin32@priv@sf@@CA?AW4Key@Keyboard@3@IJ@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetCapture@0 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::processEvent(unsigned int,unsigned int,long)" (?processEvent@WindowImplWin32@priv@sf@@AAEXIIJ@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__SetCapture@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::processEvent(unsigned int,unsigned int,long)" (?processEvent@WindowImplWin32@priv@sf@@AAEXIIJ@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__ReleaseCapture@0 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::cleanup(void)" (?cleanup@WindowImplWin32@priv@sf@@AAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetForegroundWindow@0 referenced in function "public: virtual bool __thiscall sf::priv::WindowImplWin32::hasFocus(void)const " (?hasFocus@WindowImplWin32@priv@sf@@UBE_NXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__SetForegroundWindow@4 referenced in function "public: virtual void __thiscall sf::priv::WindowImplWin32::requestFocus(void)" (?requestFocus@WindowImplWin32@priv@sf@@UAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__SetWindowTextW@8 referenced in function "public: virtual void __thiscall sf::priv::WindowImplWin32::setTitle(class sf::String const &)" (?setTitle@WindowImplWin32@priv@sf@@UAEXABVString@3@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetClientRect@8 referenced in function "public: virtual class sf::Vector2<unsigned int> __thiscall sf::priv::WindowImplWin32::getSize(void)const " (?getSize@WindowImplWin32@priv@sf@@UBE?AV?$Vector2@I@3@XZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetWindowRect@8 referenced in function "public: virtual class sf::Vector2<int> __thiscall sf::priv::WindowImplWin32::getPosition(void)const " (?getPosition@WindowImplWin32@priv@sf@@UBE?AV?$Vector2@H@3@XZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__AdjustWindowRect@12 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__ShowCursor@4 referenced in function "public: virtual void __thiscall sf::priv::WindowImplWin32::setMouseCursorVisible(bool)" (?setMouseCursorVisible@WindowImplWin32@priv@sf@@UAEX_N@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__SetCursor@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::processEvent(unsigned int,unsigned int,long)" (?processEvent@WindowImplWin32@priv@sf@@AAEXIIJ@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__ScreenToClient@8 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::processEvent(unsigned int,unsigned int,long)" (?processEvent@WindowImplWin32@priv@sf@@AAEXIIJ@Z)
sfml-window-s.lib(InputImpl.cpp.obj) : error LNK2001: unresolved external symbol __imp__ScreenToClient@8
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__MapWindowPoints@16 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::grabCursor(bool)" (?grabCursor@WindowImplWin32@priv@sf@@AAEX_N@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__ClipCursor@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::grabCursor(bool)" (?grabCursor@WindowImplWin32@priv@sf@@AAEX_N@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetWindowLongW@8 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__SetWindowLongW@12 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(struct HWND__ *)" (??0WindowImplWin32@priv@sf@@QAE@PAUHWND__@@@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetWindowThreadProcessId@8 referenced in function "public: virtual void __thiscall sf::priv::WindowImplWin32::requestFocus(void)" (?requestFocus@WindowImplWin32@priv@sf@@UAEXXZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__CreateIcon@28 referenced in function "public: virtual void __thiscall sf::priv::WindowImplWin32::setIcon(unsigned int,unsigned int,unsigned char const *)" (?setIcon@WindowImplWin32@priv@sf@@UAEXIIPBE@Z)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__DestroyIcon@4 referenced in function "public: virtual __thiscall sf::priv::WindowImplWin32::~WindowImplWin32(void)" (??1WindowImplWin32@priv@sf@@UAE@XZ)
sfml-window-s.lib(WindowImplWin32.cpp.obj) : error LNK2019: unresolved external symbol __imp__ChangeDisplaySettingsW@8 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABVString@2@IABUContextSettings@2@@Z)
sfml-window-s.lib(JoystickImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "class sf::String __cdecl `anonymous namespace'::getDeviceName(unsigned int,struct tagJOYCAPSW)" (?getDeviceName@?A0x8939b4a8@@YA?AVString@sf@@IUtagJOYCAPSW@@@Z)
sfml-window-s.lib(JoystickImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyExW@20 referenced in function "class sf::String __cdecl `anonymous namespace'::getDeviceName(unsigned int,struct tagJOYCAPSW)" (?getDeviceName@?A0x8939b4a8@@YA?AVString@sf@@IUtagJOYCAPSW@@@Z)
sfml-window-s.lib(JoystickImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__RegQueryValueExW@24 referenced in function "class sf::String __cdecl `anonymous namespace'::getDeviceName(unsigned int,struct tagJOYCAPSW)" (?getDeviceName@?A0x8939b4a8@@YA?AVString@sf@@IUtagJOYCAPSW@@@Z)
sfml-window-s.lib(InputImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetAsyncKeyState@4 referenced in function "public: static bool __cdecl sf::priv::InputImpl::isKeyPressed(enum sf::Keyboard::Key)" (?isKeyPressed@InputImpl@priv@sf@@SA_NW4Key@Keyboard@3@@Z)
sfml-window-s.lib(InputImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function "public: static bool __cdecl sf::priv::InputImpl::isMouseButtonPressed(enum sf::Mouse::Button)" (?isMouseButtonPressed@InputImpl@priv@sf@@SA_NW4Button@Mouse@3@@Z)
sfml-window-s.lib(InputImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__SetCursorPos@8 referenced in function "public: static void __cdecl sf::priv::InputImpl::setMousePosition(class sf::Vector2<int> const &)" (?setMousePosition@InputImpl@priv@sf@@SAXABV?$Vector2@H@3@@Z)
sfml-window-s.lib(InputImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__GetCursorPos@4 referenced in function "public: static class sf::Vector2<int> __cdecl sf::priv::InputImpl::getMousePosition(class sf::Window const &)" (?getMousePosition@InputImpl@priv@sf@@SA?AV?$Vector2@H@3@ABVWindow@3@@Z)
sfml-window-s.lib(InputImpl.cpp.obj) : error LNK2019: unresolved external symbol __imp__ClientToScreen@8 referenced in function "public: static void __cdecl sf::priv::InputImpl::setMousePosition(class sf::Vector2<int> const &,class sf::Window const &)" (?setMousePosition@InputImpl@priv@sf@@SAXABV?$Vector2@H@3@ABVWindow@3@@Z)
I've been looking into/attempting this over the last few evenings and my frustration has become such that I must reach out and ask for some help.
Any assistance you could provide would be really appreciated.
Thank you.