Jump to content
  • Advertisement
Sign in to follow this  

Getting started with SFML - Linker problems

This topic is 3015 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to compile one of the samples in the SFML tutorials page (this one), but I'm getting lots of linker errors that I can't make head or tail of. Here's a tiny portion of them: 1>sfml-window-s-d.lib(WindowImplWin32.obj) : warning LNK4049: locally defined symbol ?length@?$char_traits@D@std@@SAIPBD@Z (public: static unsigned int __cdecl std::char_traits<char>::length(char const *)) imported 1>sfml-window-s-d.lib(WindowImplWin32.obj) : warning LNK4217: locally defined symbol ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ (public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::size(void)const ) imported in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KAAUWindowSettings@2@@Z) 1>sfml-window-s-d.lib(Window.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (__imp_?_Orphan_all@_Container_base_secure@std@@QBEXXZ) referenced in function "public: void __thiscall std::deque<class sf::Event,class std::allocator<class sf::Event> >::push_back(class sf::Event const &)" (?push_back@?$deque@VEvent@sf@@V?$allocator@VEvent@sf@@@std@@@std@@QAEXABVEvent@sf@@@Z) 1>sfml-window-s-d.lib(VideoMode.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (__imp_?_Orphan_all@_Container_base_secure@std@@QBEXXZ) 1>sfml-window-s-d.lib(VideoModeSupport.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (__imp_?_Orphan_all@_Container_base_secure@std@@QBEXXZ) Before you ask, I have linked under Debug to the following libs: sfml-system-s-d.lib sfml-window-s-d.lib sfml-graphics-s-d.lib sfml-main-d.lib And under Release to these: sfml-system-s.lib sfml-window-s.lib sfml-graphics-s.lib sfml-main.lib Under both build configs, the default libraries(kernel32.lib, user32.lib, gdi32.lib, winspool.libcomdlg32.lib) are included. Does anyone know how to fix this?

Share this post


Link to post
Share on other sites
Advertisement
Have you tried linking with the sfml-window-d.lib file instead? As it appears all the issues are with that specific s-d library...

...or are you specifically after using the static libraries?

When I compile in debug, I just use the straight debug (dynamic) library and have no issues.

Share this post


Link to post
Share on other sites
Yeah, I'd like to statically link here.
Linking dynamically works fine, by the way, but I get an access violation reading exception at the line in which the Window App is created:


////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window"); // HERE IS WHERE I GET THE ERROR

// Start main loop
bool Running = true;
while (Running)
{
App.Display();
}

return EXIT_SUCCESS;
}

Do you know what that might be about?

Share this post


Link to post
Share on other sites
Hi

Make sure that your version of Visual C++ matches the one that the SFML libraries were compiled with.

Also make sure that you use the "Multithreaded (debug) DLL" CRT (in your project settings).

Share this post


Link to post
Share on other sites
Yeah it looks like you're linking to libraries created by a different compiler than yours.

Which compiler are you using?
Are you using pre-supplied SFML libraries, or did you build them yourself?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!