1
General / Compilation problem (undefined reference to sf::)
« on: April 25, 2015, 04:19:50 pm »
Hi
I'm working on team project in school and we are using sfml. So far I just wrote code outside the GUI section, but now I want to compile the whole thing and I'm getting standard undefined reference to sf:: error
I have Liinux Mint and I installed sfml via sudo apt-get install libsfml-dev and it didin't work so I tryed to download it from website and link it when compiling.. and I still get exactly same result.
For compilation I'm using this
Errors:
So, what am I doing wrong? Do I need to download/install something else?
I'm working on team project in school and we are using sfml. So far I just wrote code outside the GUI section, but now I want to compile the whole thing and I'm getting standard undefined reference to sf:: error
I have Liinux Mint and I installed sfml via sudo apt-get install libsfml-dev and it didin't work so I tryed to download it from website and link it when compiling.. and I still get exactly same result.
For compilation I'm using this
Quote
g++ -Wall -pedantic -g -O0 -std=c++11 -I/home/debian/SFML-2.2/include -L/home/debian/SFML-2.2/lib -lsfml-graphics -lsfml-window -lsfml-system main.cpp ...and bunch of other .cpp files
Errors:
(click to show/hide)
/tmp/ccTY0qgq.o: In function `main':
/home/debian/main.cpp:40: undefined reference to `sf::Mouse::getPosition(sf::Window const&)'
/home/debian/main.cpp:33: undefined reference to `sf::Window::pollEvent(sf::Event&)'
/home/debian/main.cpp:47: undefined reference to `sf::milliseconds(int)'
/home/debian/main.cpp:47: undefined reference to `sf::sleep(sf::Time)'
/home/debian/main.cpp:31: undefined reference to `sf::Window::isOpen() const'
/tmp/ccKdKJKh.o: In function `CButton::CButton(sf::Vector2<float> const&, unsigned int, std::string const&, sf::Font const&, sf::Color const&)':
/home/debian/GUI/CButton.cpp:13: undefined reference to `sf::RectangleShape::RectangleShape(sf::Vector2<float> const&)'
/home/debian/GUI/CButton.cpp:13: undefined reference to `sf::String::String(std::string const&, std::locale const&)'
/home/debian/GUI/CButton.cpp:13: undefined reference to `sf::Text::Text(sf::String const&, sf::Font const&, unsigned int)'
/home/debian/GUI/CButton.cpp:15: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
/home/debian/GUI/CButton.cpp:16: undefined reference to `sf::Color::Black'
/home/debian/GUI/CButton.cpp:16: undefined reference to `sf::Shape::setOutlineColor(sf::Color const&)'
/home/debian/GUI/CButton.cpp:17: undefined reference to `sf::Shape::setOutlineThickness(float)'
/home/debian/GUI/CButton.cpp:19: undefined reference to `sf::Text::setCharacterSize(unsigned int)'
/home/debian/GUI/CButton.cpp:21: undefined reference to `sf::Color::Black'
/home/debian/GUI/CButton.cpp:21: undefined reference to `sf::Text::setColor(sf::Color const&)'
/tmp/ccKdKJKh.o: In function `CButton::checkClicked(sf::Vector2<float> const&) const':
/home/debian/GUI/CButton.cpp:27: undefined reference to `sf::Shape::getGlobalBounds() const'
/tmp/ccKdKJKh.o: In function `CButton::SetTextColor(sf::Color const&)':
/home/debian/GUI/CButton.cpp:45: undefined reference to `sf::Text::setColor(sf::Color const&)'
/tmp/ccKdKJKh.o: In function `CButton::draw(sf::RenderWindow&)':
/home/debian/GUI/CButton.cpp:50: undefined reference to `sf::RenderStates::Default'
/home/debian/GUI/CButton.cpp:50: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/home/debian/GUI/CButton.cpp:51: undefined reference to `sf::RenderStates::Default'
/home/debian/GUI/CButton.cpp:51: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/tmp/ccKdKJKh.o: In function `CButton::setPosition(sf::Vector2<float> const&)':
/home/debian/GUI/CButton.cpp:56: undefined reference to `sf::Transformable::setPosition(sf::Vector2<float> const&)'
/home/debian/GUI/CButton.cpp:57: undefined reference to `sf::Text::getGlobalBounds() const'
/home/debian/GUI/CButton.cpp:57: undefined reference to `sf::Transformable::setPosition(float, float)'
/home/debian/GUI/CButton.cpp:58: undefined reference to `sf::Text::getGlobalBounds() const'
/home/debian/GUI/CButton.cpp:59: undefined reference to `sf::RectangleShape::setSize(sf::Vector2<float> const&)'
/home/debian/GUI/CButton.cpp:60: undefined reference to `sf::Transformable::setPosition(float, float)'
/tmp/ccKdKJKh.o: In function `CButton::setSize(sf::Vector2<float> const&)':
/home/debian/GUI/CButton.cpp:65: undefined reference to `sf::Text::getGlobalBounds() const'
/home/debian/GUI/CButton.cpp:68: undefined reference to `sf::Transformable::setPosition(float, float)'
/home/debian/GUI/CButton.cpp:69: undefined reference to `sf::RectangleShape::setSize(sf::Vector2<float> const&)'
/tmp/ccKdKJKh.o: In function `CButton::setCharSize(unsigned int)':
/home/debian/GUI/CButton.cpp:74: undefined reference to `sf::Text::setCharacterSize(unsigned int)'
/home/debian/GUI/CButton.cpp:75: undefined reference to `sf::Transformable::getPosition() const'
/tmp/ccKdKJKh.o: In function `CButton::buttonPressed(sf::Vector2<float> const&)':
/home/debian/GUI/CButton.cpp:79: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:80: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:81: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:81: undefined reference to `sf::RectangleShape::getSize() const'
/home/debian/GUI/CButton.cpp:82: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:82: undefined reference to `sf::RectangleShape::getSize() const'
/tmp/ccKdKJKh.o: In function `sf::Transformable::Transformable(sf::Transformable const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/Transformable.hpp:41: undefined reference to `vtable for sf::Transformable'
/tmp/ccKdKJKh.o: In function `sf::VertexArray::VertexArray(sf::VertexArray const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/VertexArray.hpp:45: undefined reference to `vtable for sf::VertexArray'
/tmp/ccKdKJKh.o: In function `sf::Shape::Shape(sf::Shape const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/Shape.hpp:44: undefined reference to `vtable for sf::Shape'
/home/debian/SFML-2.2/include/SFML/Graphics/Shape.hpp:44: undefined reference to `vtable for sf::Shape'
/home/debian/SFML-2.2/include/SFML/Graphics/Shape.hpp:44: undefined reference to `sf::Transformable::~Transformable()'
/tmp/ccKdKJKh.o: In function `sf::RectangleShape::RectangleShape(sf::RectangleShape const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/RectangleShape.hpp:41: undefined reference to `vtable for sf::RectangleShape'
/home/debian/SFML-2.2/include/SFML/Graphics/RectangleShape.hpp:41: undefined reference to `vtable for sf::RectangleShape'
/tmp/ccKdKJKh.o: In function `sf::Text::Text(sf::Text const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `sf::String::String(sf::String const&)'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `sf::Transformable::~Transformable()'
/tmp/ccKdKJKh.o: In function `sf::Text::~Text()':
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `sf::Transformable::~Transformable()'
and so on for 300 lines
/home/debian/main.cpp:40: undefined reference to `sf::Mouse::getPosition(sf::Window const&)'
/home/debian/main.cpp:33: undefined reference to `sf::Window::pollEvent(sf::Event&)'
/home/debian/main.cpp:47: undefined reference to `sf::milliseconds(int)'
/home/debian/main.cpp:47: undefined reference to `sf::sleep(sf::Time)'
/home/debian/main.cpp:31: undefined reference to `sf::Window::isOpen() const'
/tmp/ccKdKJKh.o: In function `CButton::CButton(sf::Vector2<float> const&, unsigned int, std::string const&, sf::Font const&, sf::Color const&)':
/home/debian/GUI/CButton.cpp:13: undefined reference to `sf::RectangleShape::RectangleShape(sf::Vector2<float> const&)'
/home/debian/GUI/CButton.cpp:13: undefined reference to `sf::String::String(std::string const&, std::locale const&)'
/home/debian/GUI/CButton.cpp:13: undefined reference to `sf::Text::Text(sf::String const&, sf::Font const&, unsigned int)'
/home/debian/GUI/CButton.cpp:15: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
/home/debian/GUI/CButton.cpp:16: undefined reference to `sf::Color::Black'
/home/debian/GUI/CButton.cpp:16: undefined reference to `sf::Shape::setOutlineColor(sf::Color const&)'
/home/debian/GUI/CButton.cpp:17: undefined reference to `sf::Shape::setOutlineThickness(float)'
/home/debian/GUI/CButton.cpp:19: undefined reference to `sf::Text::setCharacterSize(unsigned int)'
/home/debian/GUI/CButton.cpp:21: undefined reference to `sf::Color::Black'
/home/debian/GUI/CButton.cpp:21: undefined reference to `sf::Text::setColor(sf::Color const&)'
/tmp/ccKdKJKh.o: In function `CButton::checkClicked(sf::Vector2<float> const&) const':
/home/debian/GUI/CButton.cpp:27: undefined reference to `sf::Shape::getGlobalBounds() const'
/tmp/ccKdKJKh.o: In function `CButton::SetTextColor(sf::Color const&)':
/home/debian/GUI/CButton.cpp:45: undefined reference to `sf::Text::setColor(sf::Color const&)'
/tmp/ccKdKJKh.o: In function `CButton::draw(sf::RenderWindow&)':
/home/debian/GUI/CButton.cpp:50: undefined reference to `sf::RenderStates::Default'
/home/debian/GUI/CButton.cpp:50: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/home/debian/GUI/CButton.cpp:51: undefined reference to `sf::RenderStates::Default'
/home/debian/GUI/CButton.cpp:51: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/tmp/ccKdKJKh.o: In function `CButton::setPosition(sf::Vector2<float> const&)':
/home/debian/GUI/CButton.cpp:56: undefined reference to `sf::Transformable::setPosition(sf::Vector2<float> const&)'
/home/debian/GUI/CButton.cpp:57: undefined reference to `sf::Text::getGlobalBounds() const'
/home/debian/GUI/CButton.cpp:57: undefined reference to `sf::Transformable::setPosition(float, float)'
/home/debian/GUI/CButton.cpp:58: undefined reference to `sf::Text::getGlobalBounds() const'
/home/debian/GUI/CButton.cpp:59: undefined reference to `sf::RectangleShape::setSize(sf::Vector2<float> const&)'
/home/debian/GUI/CButton.cpp:60: undefined reference to `sf::Transformable::setPosition(float, float)'
/tmp/ccKdKJKh.o: In function `CButton::setSize(sf::Vector2<float> const&)':
/home/debian/GUI/CButton.cpp:65: undefined reference to `sf::Text::getGlobalBounds() const'
/home/debian/GUI/CButton.cpp:68: undefined reference to `sf::Transformable::setPosition(float, float)'
/home/debian/GUI/CButton.cpp:69: undefined reference to `sf::RectangleShape::setSize(sf::Vector2<float> const&)'
/tmp/ccKdKJKh.o: In function `CButton::setCharSize(unsigned int)':
/home/debian/GUI/CButton.cpp:74: undefined reference to `sf::Text::setCharacterSize(unsigned int)'
/home/debian/GUI/CButton.cpp:75: undefined reference to `sf::Transformable::getPosition() const'
/tmp/ccKdKJKh.o: In function `CButton::buttonPressed(sf::Vector2<float> const&)':
/home/debian/GUI/CButton.cpp:79: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:80: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:81: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:81: undefined reference to `sf::RectangleShape::getSize() const'
/home/debian/GUI/CButton.cpp:82: undefined reference to `sf::Transformable::getPosition() const'
/home/debian/GUI/CButton.cpp:82: undefined reference to `sf::RectangleShape::getSize() const'
/tmp/ccKdKJKh.o: In function `sf::Transformable::Transformable(sf::Transformable const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/Transformable.hpp:41: undefined reference to `vtable for sf::Transformable'
/tmp/ccKdKJKh.o: In function `sf::VertexArray::VertexArray(sf::VertexArray const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/VertexArray.hpp:45: undefined reference to `vtable for sf::VertexArray'
/tmp/ccKdKJKh.o: In function `sf::Shape::Shape(sf::Shape const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/Shape.hpp:44: undefined reference to `vtable for sf::Shape'
/home/debian/SFML-2.2/include/SFML/Graphics/Shape.hpp:44: undefined reference to `vtable for sf::Shape'
/home/debian/SFML-2.2/include/SFML/Graphics/Shape.hpp:44: undefined reference to `sf::Transformable::~Transformable()'
/tmp/ccKdKJKh.o: In function `sf::RectangleShape::RectangleShape(sf::RectangleShape const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/RectangleShape.hpp:41: undefined reference to `vtable for sf::RectangleShape'
/home/debian/SFML-2.2/include/SFML/Graphics/RectangleShape.hpp:41: undefined reference to `vtable for sf::RectangleShape'
/tmp/ccKdKJKh.o: In function `sf::Text::Text(sf::Text const&)':
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `sf::String::String(sf::String const&)'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `sf::Transformable::~Transformable()'
/tmp/ccKdKJKh.o: In function `sf::Text::~Text()':
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `vtable for sf::Text'
/home/debian/SFML-2.2/include/SFML/Graphics/Text.hpp:48: undefined reference to `sf::Transformable::~Transformable()'
and so on for 300 lines
So, what am I doing wrong? Do I need to download/install something else?