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

Author Topic: Simple graphics window compilation error  (Read 2193 times)

0 Members and 2 Guests are viewing this topic.

flaynk

  • Newbie
  • *
  • Posts: 7
    • View Profile
Simple graphics window compilation error
« on: December 08, 2011, 03:46:58 pm »
I have already searched the forum for this answer, but it was no where to be found

The following is my code used
Code: [Select]

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

using namespace std;

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;
}


When I build it, it returns successful with no errors in the code. When I click RUN, the console shows up fine, but AS SOON AS the window shows up an error box appears. I took a snapshot of this:



I also took a picture of the libraries listed in the linker:



Hopefully you can help. Thanks.

Note: SFML DOES compile UNTIL I add the ".Clear()" function

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Simple graphics window compilation error
« Reply #1 on: December 08, 2011, 03:50:11 pm »
Quote
I have already searched the forum for this answer, but it was no where to be found

There are so many messages about this problem... :P

You must recompile SFML, the VC++ 2008 libraries are not compatible with 2010.
Laurent Gomila - SFML developer

flaynk

  • Newbie
  • *
  • Posts: 7
    • View Profile
Simple graphics window compilation error
« Reply #2 on: December 08, 2011, 03:52:44 pm »
Where can I get libs that are compatible with 2010?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Simple graphics window compilation error
« Reply #3 on: December 08, 2011, 04:00:23 pm »
Quote from: "Laurent"
You must recompile SFML
Laurent Gomila - SFML developer

flaynk

  • Newbie
  • *
  • Posts: 7
    • View Profile
Simple graphics window compilation error
« Reply #4 on: December 08, 2011, 04:02:53 pm »
Yes, I see that. What do you mean though? I'm a little new to this stuff. Recompile it? Do you mean delete SFML from my computer, then re-download it? I don't understand.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Simple graphics window compilation error
« Reply #5 on: December 08, 2011, 04:21:54 pm »
No, I really mean "compile SFML". The same way you do with your own project. Open the SFML.sln file in Visual Studio, and click the "compile button".

It is explained in other similar topics on this forum. There are even video tutorials if you can find them.
Laurent Gomila - SFML developer

flaynk

  • Newbie
  • *
  • Posts: 7
    • View Profile
Simple graphics window compilation error
« Reply #6 on: December 08, 2011, 05:31:26 pm »
This is driving me insane.

I found the video that walks you through compiling SFML in 2010. I did EVERYTHING exactly the same.

I then tried to build the same above code, and now I have errors. What in the world is going on here?

Error is this:

Code: [Select]
1>------ Build started: Project: sfml-test2, Configuration: Debug Win32 ------
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Close(void)" (?Close@Window@sf@@QAEXXZ) referenced in function _main
1>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
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ) referenced in function _main
1>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
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::Window::~Window(void)" (??1Window@sf@@UAE@XZ) referenced in function __unwindfunclet$??0RenderWindow@sf@@QAE@XZ$0
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: __thiscall sf::Window::Window(void)" (??0Window@sf@@QAE@XZ) referenced in function "public: __thiscall sf::RenderWindow::RenderWindow(void)" (??0RenderWindow@sf@@QAE@XZ)
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2001: unresolved external symbol "private: virtual void __thiscall sf::Window::OnEvent(class sf::Event const &)" (?OnEvent@Window@sf@@EAEXABVEvent@2@@Z)
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Create(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (?Create@Window@sf@@QAEXVVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@2@@Z) referenced in function "public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z)
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Create(void *,struct sf::WindowSettings const &)" (?Create@Window@sf@@QAEXPAXABUWindowSettings@2@@Z) referenced in function "public: __thiscall sf::RenderWindow::RenderWindow(void *,struct sf::WindowSettings const &)" (??0RenderWindow@sf@@QAE@PAXABUWindowSettings@1@@Z)
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::SetActive(bool)const " (?SetActive@Window@sf@@QBE_N_N@Z) referenced in function "private: virtual bool __thiscall sf::RenderWindow::Activate(bool)" (?Activate@RenderWindow@sf@@EAE_N_N@Z)
1>sfml-graphics-s-d.lib(Image.obj) : error LNK2001: unresolved external symbol "public: bool __thiscall sf::Window::SetActive(bool)const " (?SetActive@Window@sf@@QBE_N_N@Z)
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall sf::Window::GetWidth(void)const " (?GetWidth@Window@sf@@QBEIXZ) referenced in function "public: virtual unsigned int __thiscall sf::RenderWindow::GetWidth(void)const " (?GetWidth@RenderWindow@sf@@UBEIXZ)
1>sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall sf::Window::GetHeight(void)const " (?GetHeight@Window@sf@@QBEIXZ) referenced in function "public: virtual unsigned int __thiscall sf::RenderWindow::GetHeight(void)const " (?GetHeight@RenderWindow@sf@@UBEIXZ)
1>sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: void __thiscall sf::Context::SetActive(bool)" (?SetActive@Context@sf@@QAEX_N@Z) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
1>sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: static class sf::Context & __cdecl sf::Context::GetGlobal(void)" (?GetGlobal@Context@sf@@SAAAV12@XZ) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
1>sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl sf::Context::IsContextActive(void)" (?IsContextActive@Context@sf@@SA_NXZ) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
1>C:\Users\luke.rackliffe\documents\visual studio 2010\Projects\sfml-test2\Debug\sfml-test2.exe : fatal error LNK1120: 16 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

flaynk

  • Newbie
  • *
  • Posts: 7
    • View Profile
Simple graphics window compilation error
« Reply #7 on: December 08, 2011, 05:32:38 pm »
I really want to use SFML, but I can't go any further until I figure out what's going on here. Thanks for your help by the way.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Simple graphics window compilation error
« Reply #8 on: December 08, 2011, 06:21:58 pm »
Have you defined SFML_DYNAMIC?
Laurent Gomila - SFML developer

flaynk

  • Newbie
  • *
  • Posts: 7
    • View Profile
Simple graphics window compilation error
« Reply #9 on: December 08, 2011, 06:35:18 pm »
I have not, where do I put that at?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Simple graphics window compilation error
« Reply #10 on: December 08, 2011, 06:37:50 pm »
Look at the VC++ 2008 tutorial, and try to adapt (it should be almost the same ;) ). I don't know Visual Studio 2010 so I can't help more.
Laurent Gomila - SFML developer

flaynk

  • Newbie
  • *
  • Posts: 7
    • View Profile
Simple graphics window compilation error
« Reply #11 on: December 08, 2011, 06:42:12 pm »
Would it be easier for me to just download VC++ 2008?

 

anything