• Cannot Get SFML Working with Any IDE
    4 replies, posted
  • Avatar of thirty9th
  • 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; } [/code] 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 ===| [/code] 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.
  • 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
  • [URL="http://sfmlcoder.wordpress.com/2011/05/18/creating-a-first-sfml-project/"]This helped me a lot when I used to use SFML.[/URL] It also has videos if that is more convenient for you.
  • Avatar of ief014
  • 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 [URL="http://www.sfml-dev.org/download.php#2.0-rc"]SFML 2[/URL] instead