Hi,
I recently set up Codeblocks and sfml and have been getting this error:
mingw32-g++.exe -Wall -std=c++14 -fexceptions -std=c++14 -g -std=c++14 -IC:\Users\Zenarii\Documents\Libraries\CPP\SFML-2.4.2\include -IC:\Users\Zenarii\Documents\Libraries\CPP\SFML-2.4.2\include -c C:\Users\Zenarii\Documents\CPP\BlockBreak\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\Users\Zenarii\Documents\Libraries\CPP\SFML-2.4.2\lib -LC:\Users\Zenarii\Documents\Libraries\CPP\SFML-2.4.2\lib -o bin\Debug\BlockBreak.exe obj\Debug\main.o -lsfml-graphics -lsfml-audio -lsfml-network -lsfml-window -lsfml-system -lsfml-graphics-d -lsfml-audio-d -lsfml-network-d -lsfml-window-d -lsfml-system-d
obj\Debug\main.o: In function `main':
C:/Users/Zenarii/Documents/CPP/BlockBreak/main.cpp:14: undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'
C:/Users/Zenarii/Documents/CPP/BlockBreak/main.cpp:15: undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'
C:/Users/Zenarii/Documents/CPP/BlockBreak/main.cpp:16: undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'
C:/Users/Zenarii/Documents/CPP/BlockBreak/main.cpp:17: undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'
collect2.exe: error: ld returned 1 exit status
when trying to build this code (there is more this is just the part creating the error)
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow app(sf::VideoMode(800,600), "Break Out!");
//load textures
sf::Texture block, paddle, background, ball;
block.loadFromFile("images/block.png");
paddle.loadFromFile("images/paddle.png");
background.loadFromFile("images/background.png");
ball.loadFromFile("images/background.png");
When searching the issue I found resources that said to reinstall SFML but that didn't work for me. Additionally the tutorial i followed also supplied this code:
https://pastebin.com/DdeQ6vQw which worked fine.
Thanks for any help