1. Post #1
    Gold Member
    thirty9th's Avatar
    November 2006
    1,365 Posts
    Title says it all. This is really frustrating.

    I have a fresh install of SFML 1.6 that I cannot get to mesh with either Netbeans (my preferred IDE) or Code::Blocks (even following the exact tutorial on the SFML website).

    The same error occurs in every compilation no matter which settings I tweak or which libraries I link. For example, this simple program:

    Code:
    #include <cstdlib>
    #include <SFML/Window.hpp>
    
    using namespace std;
    
    /*
     *
     */
    
    int main() {
    
        sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
    
        bool running = true;
    
        while (running) {
            App.Display();
        }
    
        return EXIT_SUCCESS;
    
    }
    Produces this error:

    Code:
    obj\Debug\main.o||In function `main':|
    C:\Users\...\Documents\gegl-0.0\CodeBlocks\SFMLTest\main.cpp|19|undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
    C:\Users\...\Documents\gegl-0.0\CodeBlocks\SFMLTest\main.cpp|19|undefined reference to `sf::Window::Window(sf::VideoMode, std::string const&, unsigned long, sf::WindowSettings const&)'|
    C:\Users\...\Documents\gegl-0.0\CodeBlocks\SFMLTest\main.cpp|24|undefined reference to `sf::Window::Display()'|
    C:\Users\...\Documents\gegl-0.0\CodeBlocks\SFMLTest\main.cpp|19|undefined reference to `sf::Window::~Window()'|
    C:\Users\...\Documents\gegl-0.0\CodeBlocks\SFMLTest\main.cpp|19|undefined reference to `sf::Window::~Window()'|
    C:\Users\...\Documents\gegl-0.0\CodeBlocks\SFMLTest\main.cpp|19|undefined reference to `sf::Window::~Window()'|
    ||=== Build finished: 6 errors, 0 warnings ===|
    The same goes for Netbeans. Same exact errors. Every time.

    I have set the proper include directories for both programs and specified the library directories (e.g. C:\SFML 1.6\include and C:\SFML 1.6\lib) and have even gone so far as to include the flag to the g++ command (-lsfml-window -lsfml-system), to no avail.

    I have exhausted every Google link I can find and not gotten a single solid answer as to what is going on. This is beyond frustrating for me; fiddling around with a library/environment instead of actually getting experience and writing some code.

    Surely someone here has some experience with SFML and can either tell me what I'm doing wrong or recommend a better IDE.

  2. Post #2
    It's a boomer! Watch out!
    boomer678's Avatar
    March 2009
    1,519 Posts
    I sent you a pm
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Friendly Friendly x 1 (list)

  3. Post #3
    Icedshot's Avatar
    April 2010
    2,361 Posts
    Try defining SFML_STATIC. in code blocks there's a handy place you can put it in project options i think, or maybe it's build options
    Reply With Quote Edit / Delete Reply Mac United Kingdom Show Events Friendly Friendly x 1Agree Agree x 1 (list)

  4. Post #4
    Ask Rohan about rust keys!
    Bumrang's Avatar
    August 2011
    2,854 Posts
    This helped me a lot when I used to use SFML.
    It also has videos if that is more convenient for you.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Friendly Friendly x 1 (list)

  5. Post #5
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    3,069 Posts
    If running in debug mode, it requires the debug libraries
    If using static libraries, define "SFML_STATIC"

    If those don't work, try the new SFML 2 instead
    Reply With Quote Edit / Delete Reply Windows 7 Germany Show Events Friendly Friendly x 1Agree Agree x 1 (list)