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

Author Topic: Linker Problems  (Read 1733 times)

0 Members and 1 Guest are viewing this topic.

Null

  • Newbie
  • *
  • Posts: 2
    • View Profile
Linker Problems
« on: October 13, 2009, 04:52:53 pm »
I've been having issues trying to link to the SFML libraries, specifically sfml-window and sfml-graphics. I've tried all the configurations I could think of, debug, release, static-debug, static-release, etc. Taking note to define SFML_DYNAMIC for any of the dynamic libraries.

With the following code taken from the tutorials, including the libraries sfml-main-d.lib and sfml-window-s-d.lib -
Code: [Select]
#include <SFML/Window.hpp>

int main(int argc, char** argv)
{
// Create the main rendering window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start game loop
    while (App.IsOpened())
    {

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


I receive the following linker errors -
Code: [Select]
1>sfml-window-s-d.lib(Window.obj) : error LNK2019: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) referenced in function "public: __thiscall sf::Window::Window(void)" (??0Window@sf@@QAE@XZ)
1>sfml-window-s-d.lib(Window.obj) : error LNK2019: unresolved external symbol "public: void __thiscall sf::Clock::Reset(void)" (?Reset@Clock@sf@@QAEXXZ) referenced in function "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ)
1>sfml-window-s-d.lib(Window.obj) : error LNK2019: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) referenced in function "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ)
1>sfml-window-s-d.lib(Window.obj) : error LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ)


I've also built the libraries from source as well, hoping it would solve the issue, but alas nothing seems to be helping. I've noticed that it's particularly having issues with sf::Clock's methods and sf::Sleep. I'm hoping I'm just missing something simple, otherwise I may just try and remove Clock/Sleep from the libraries and re-build them. Though I'd rather not have to start hacking and slashing the libraries.

Compiled under Windows 7 64-bit, Visual Studio 2008 Professional

Oh, and just in case it helps, here's the command line taken from VS9.
Code: [Select]
/OUT:"C:\Users\Null\Projects\Test\Debug\Test.exe" /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTFILE:"Debug\Test.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\Null\Projects\Test\Debug\Test.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT sfml-main-d.lib sfml-window-s-d.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Linker Problems
« Reply #1 on: October 13, 2009, 07:21:14 pm »
You forgot to link to sfml-system :)
Laurent Gomila - SFML developer

Null

  • Newbie
  • *
  • Posts: 2
    • View Profile
Linker Problems
« Reply #2 on: October 14, 2009, 02:16:34 am »
*Facepalms*

Knew it had to be something simple I glanced over. I suppose I only saw it linking to sfml-window with the given tutorial and figured that system would include itself "magically".

Thanks for that :wink: