Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem Full static link SFML 2.5.1 on visual studio 2017  (Read 2031 times)

0 Members and 1 Guest are viewing this topic.

Jacky88

  • Newbie
  • *
  • Posts: 1
    • View Profile
Problem Full static link SFML 2.5.1 on visual studio 2017
« on: February 07, 2020, 01:32:10 pm »
-------
Background to problem (skip if uninterested)
-------
I create new empty project with SFML 2.5.1 follow this guide: https://www.sfml-dev.org/tutorials/2.5/start-vc.php. I try to use full static linker.
-------

Operating system: Windows 10
Visual studio version: Visual studio 2017
SFML Version: 2.5.1-vc15-32-bit

In all configurations I have:
C/C++ >> General >> Additional Include Directories >> linked to the include folder
Linker >> General >> Additional Library Directories >> linked to the lib folder
C/C++ >> Preprocessor >> SFML_STATIC

in my release I have:
Linker >> input >> additional dependencies
opengl32.lib
winmm.lib
gdi32.lib
freetype.lib
sfml-system-s.lib
sfml-window-s.lib
sfml-graphics-s.lib


in Debug:
Linker >> input >> additional dependencies
freetype.lib
gdi32.lib
winmm.lib
opengl32.lib
sfml-system-s-d.lib
sfml-window-s-d.lib
sfml-graphics-s-d.lib

=============
But I can not build project successfully. It raised LNK2019 and LNK2001 error like that:
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)   SFMLExample   C:\CppTraining\TrainingCpp\SFMLExample\sfml-window-s-d.lib(CursorImpl.cpp.obj)   1   
Error   LNK2001   unresolved external symbol __imp__GetDC@4   SFMLExample   C:\CppTraining\TrainingCpp\SFMLExample\sfml-window-s-d.lib(WglContext.cpp.obj)   1   

I try to search but don't find the problem. Please help me !!
Thanks


Fx8qkaoy

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: Problem Full static link SFML 2.5.1 on visual studio 2017
« Reply #1 on: February 07, 2020, 08:13:36 pm »
-------
Background to problem (skip if uninterested)
-------
I create new empty project with SFML 2.5.1 follow this guide: https://www.sfml-dev.org/tutorials/2.5/start-vc.php. I try to use full static linker.
-------

Operating system: Windows 10
Visual studio version: Visual studio 2017
SFML Version: 2.5.1-vc15-32-bit

In all configurations I have:
C/C++ >> General >> Additional Include Directories >> linked to the include folder
Linker >> General >> Additional Library Directories >> linked to the lib folder
C/C++ >> Preprocessor >> SFML_STATIC

in my release I have:
Linker >> input >> additional dependencies
opengl32.lib
winmm.lib
gdi32.lib
freetype.lib
sfml-system-s.lib
sfml-window-s.lib
sfml-graphics-s.lib


in Debug:
Linker >> input >> additional dependencies
freetype.lib
gdi32.lib
winmm.lib
opengl32.lib
sfml-system-s-d.lib
sfml-window-s-d.lib
sfml-graphics-s-d.lib

=============
But I can not build project successfully. It raised LNK2019 and LNK2001 error like that:
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)   SFMLExample   C:\CppTraining\TrainingCpp\SFMLExample\sfml-window-s-d.lib(CursorImpl.cpp.obj)   1   
Error   LNK2001   unresolved external symbol __imp__GetDC@4   SFMLExample   C:\CppTraining\TrainingCpp\SFMLExample\sfml-window-s-d.lib(WglContext.cpp.obj)   1   

I try to search but don't find the problem. Please help me !!
Thanks

Open the project properties and make sure that current configuration is on "Active", same as platform. Now recheck everything. If something is not right, then u found the problem

 

anything