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

Author Topic: Help setting sfml up  (Read 2011 times)

0 Members and 1 Guest are viewing this topic.

Draoz

  • Newbie
  • *
  • Posts: 1
    • View Profile
Help setting sfml up
« on: March 19, 2010, 08:37:53 pm »
I need some help getting sfml to work correctly. Here is the code i'm trying to compile.

Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>



int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
   
    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

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

    return EXIT_SUCCESS;
}



Here is the build log.
Code: [Select]

 

Creating temporary file "c:\Users\Daniel\Desktop\C++\WORK!\Debug\RSP00003245642428.rsp" with contents
[
/OUT:"C:\Users\Daniel\Desktop\C++\WORK!\Debug\WORK!.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\WORK!.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\Daniel\Desktop\C++\WORK!\Debug\WORK!.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE /NXCOMPAT /MACHINE:X86 sfml-system-d.lib sfml-graphics-d.lib sfml-main-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

".\Debug\Main.obj"

".\Debug\WORK!.exe.embed.manifest.res"
]
Creating command line "link.exe @"c:\Users\Daniel\Desktop\C++\WORK!\Debug\RSP00003245642428.rsp" /NOLOGO /ERRORREPORT:PROMPT"


Output Window.

Code: [Select]

 

Linking...
Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Close(void)" (?Close@Window@sf@@QAEXXZ) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main
C:\Users\Daniel\Desktop\C++\WORK!\Debug\WORK!.exe : fatal error LNK1120: 5 unresolved externals


Thanks in advance.

TurboLento

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://pjmendes.blogspot.com/
Help setting sfml up
« Reply #1 on: April 01, 2010, 03:26:24 pm »
Hi,
I think you're not linking to "sfml-window-d.lib". In your "Additional Dependencies" section, add libraries in this order:
sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib

Oddly, I think the tutorial page for compiling with SFML in VC++ doesn't mention this, but the one for Code::Blocks does.

Edit: edited for library order correction.
Game development blog: http://pjmendes.blogspot.com/

 

anything