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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - djninjamaster13

Pages: [1]
1
General / Undefined Reference Problem with texture.loadFromFile();
« on: January 29, 2018, 02:06:36 pm »
Hey Guys, newbie here.

From the start, I would like to acknowledge that I know there are other posts that had this problem, but I couldn't figure out how to fix it with any of the solutions from those posts. I am using Code::Blocks 17.12 on Windows 10 with the TDM 4.9.2 (32 bit) compiler and SFML version 2.4.2. I am trying to incorporate a texture to use with a sprite, but I get an error code every time.

My code (the lines that produce the error):

sf::Texture texture;
    if (!texture.loadFromFile("")) {
        cout << "ERROR LOADING TEXTURE!!!!!" << endl;
    }

Error Code:

||=== Build: Debug in CompScience-2 (compiler: TDM Compiler17) ===|
obj\Debug\game.o||In function `main':|
C:\Users\djnin\Documents\CompScience-2\game.cpp|10|undefined reference to `sf::Texture::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, sf::Rect<int> const&)'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Most posts suggested changing the compiler to match SFML, but I switched from my original GNU GCC Compiler to the TDM 4.9.2 from the SFML website and nothing changed. Should I try a different compiler or did I most likely install the TDM one incorrectly? Thanks in advance!

Pages: [1]