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

Author Topic: Undefined references (rendering a window)  (Read 2015 times)

0 Members and 1 Guest are viewing this topic.

Cerus

  • Newbie
  • *
  • Posts: 3
    • View Profile
Undefined references (rendering a window)
« on: September 16, 2011, 03:00:41 am »
Hi, I've just recently chosen to try out SFML with C++ and followed a video tutorial on Youtube to try and render a window (practice for a project I'm planning) and got the following errors:

Code: [Select]

/home/username/Documents/cppStuff/Window/SFML_Window.o||In function `main':|
SFML_Window.cpp|| undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
SFML_Window.cpp|| undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, sf::WindowSettings const&)'|
SFML_Window.cpp|| undefined reference to `sf::Window::Close()'|
SFML_Window.cpp|| undefined reference to `sf::Window::GetEvent(sf::Event&)'|
SFML_Window.cpp|| undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|
SFML_Window.cpp|| undefined reference to `sf::RenderTarget::Clear(sf::Color const&)'|
SFML_Window.cpp|| undefined reference to `sf::Window::Display()'|
SFML_Window.cpp|| undefined reference to `sf::Window::IsOpened() const'|
SFML_Window.cpp|| undefined reference to `sf::RenderWindow::~RenderWindow()'|
SFML_Window.cpp|| undefined reference to `sf::RenderWindow::~RenderWindow()'|
SFML_Window.cpp|| undefined reference to `sf::RenderWindow::~RenderWindow()'|
||=== Build finished: 11 errors, 0 warnings ===|


I'm running Ubuntu 11.04 and have been using Gedit or Code::Blocks (depending on how much 'interface' I feel like tolerating).  Here is the code from the tutorial, which I used:

Code: [Select]

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

int main()
{
    sf::RenderWindow Game(sf::VideoMode(640, 480, 32), "SFML Test");

    sf::Event Event;

    while(Game.IsOpened())
    {
        while(Game.GetEvent(Event))
        {
            if(Event.Type == sf::Event::Closed)
                Game.Close();
        }

        Game.Clear();
        Game.Display();
    }
   
    return EXIT_SUCCESS;
}


I have no idea why these errors are happening (yes, I've installed sfml, and these errors happened in Code::Blocks, if I haven't already said so),
so I'm hoping someone here can tolerate the length of the post and lend a hand.  Any help is appreciated, this kind of thing is ridiculously annoying.  @_@;  Thanks![/code]

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Undefined references (rendering a window)
« Reply #1 on: September 16, 2011, 03:02:19 am »
your not linking with SFML

Cerus

  • Newbie
  • *
  • Posts: 3
    • View Profile
Undefined references (rendering a window)
« Reply #2 on: September 16, 2011, 03:32:01 am »
Thanks a ton!  I got it to compile in terminal (I really should try and set up the linkers in codeblocks, though, just for convenience's sake)  Next, I need to figure out how to disable window-resizing...  *gets back to searching*

I think I can handle things fine from here.  ^_^

 

anything