SFML community forums
Help => Graphics => Topic started by: zedong on December 14, 2016, 12:35:01 pm
-
Hello, I just recently tried to compile my project as a windows .exe.
Linking the sfml lib worked fine, and the test project from the tutorial page worked fine, however, when I try to compile my project, it complains about every single loadFromFile is undefined.
Using gcc 9.4.2 with SFML 2.4.2 in Code::Blocks.
The message I get is:
C:\Users\Kristian\Desktop\project\vk\Menu.cc|202|undefined reference to `sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&)'|
Thanks in advance.
Edit: It compiles just fine if I comment out every single loadFromFile, but obviously that just leaves me with a blank window.
-
You're probably using a different compiler than the one that was used to compile the SFML binaries. The compilers need to match 100%.
Either build SFML yourself with your compiler (it's easy!) or check the download page to see which compilers have been used for the provided binaries.
-
Using the gcc TDM 4.9.2 linked from http://www.sfml-dev.org/download/sfml/2.4.1/.
-
Maybe you build your project with C++11 but SFML is not built with C++11 (there have been a change in the ABI of the GCC standard lib with C++11).
-
I've tried both with and without -std=c++11 with the same result unfortunaly.
-
Make sure the actual build command doesn't contain a -std=c++11 anymore. Sometimes these settings are rather hidden.
Otherwise try to rebuild SFML with -std=c++11.
Or alternatively update your compiler to another one listed on the download page and get the respective binaries.