我已经在 debian 上为学校项目安装了 SFML1.6。
在编译时我有这些错误:
g++ -c main.cpp
g++ main.o -o 炸弹人 -lsfml-graphics
/usr/local/lib/libsfml-graphics.so:未定义对
sf::Unicode::Text::Text()' /usr/local/lib/libsfml-graphics.so: undefined reference to
sf::Context::GetGlobal()' 的引用 /usr/local/lib/libsfml-graphics.so:未定义对sf::Window::OnEvent(sf::Event const&)' /usr/local/lib/libsfml-graphics.so: undefined reference to
sf::Window::Create( sf::VideoMode, std::basic_string, std::allocator > const&, unsigned long, sf::WindowSettings const&)' /usr/local/lib/libsfml-graphics.so: 未定义sf::Context::SetActive(bool)' /usr/local/lib/libsfml-graphics.so: undefined reference to
对 sf::Window 的 typeinfo 的引用/usr/local/lib/libsfml-graphics.so:未定义对sf::Window::Create(unsigned long, sf::WindowSettings const&)' /usr/local/lib/libsfml-graphics.so: undefined reference to
sf::Window::GetHeight() 的引用 const' /usr/local/lib/libsfml-graphics.so:未定义对sf::Window::Window()' /usr/local/lib/libsfml-graphics.so: undefined reference to
sf::Unicode::Text的引用::Text(unsigned int const*)' /usr/local/lib/libsfml-graphics.so:未定义对sf::Window::~Window()' /usr/local/lib/libsfml-graphics.so: undefined reference to
sf::Context::IsContextActive()' 的引用 /usr/local/lib/libsfml-graphics.so:未定义参考sf::Window::SetActive(bool) const' /usr/local/lib/libsfml-graphics.so: undefined reference to
sf::Unicode::Text::operator std::basic_string, std::allocator > const&() const' /usr/local/lib/libsfml-graphics.so: 未定义引用 `sf::Window::GetWidth( ) const' collect2: ld 返回 1 退出状态 make: * [all] Error 1
我不明白为什么会出现这些错误。libsfml-* 位于 /usr/lib/ 中,所有需要的包含在 /usr/include 中