Sign in to follow this  
bepawuca

Getting started with SFML - Linker problems

Recommended Posts

bepawuca    114
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
BCullis    1955
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
bepawuca    114
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
LaurentGom    186
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this