我在usr / include /中有SFML库,如果我想包含它,我会收到错误,找不到该目录。
我在Ubuntu上使用Netbeans,在Tools / Options / C ++中使用了正确的SFML目录。
任何人都知道这件事是什么?
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
cd&#39; / home / user / NetBeansProjects / erstertest&#39; / usr / bin / make -f Makefile CONF = Debug&#34; / usr / bin / make&#34; -f nbproject / Makefile-Debug.mk QMAKE = SUBPROJECTS = .build-conf make [1]:输入目录 &#39; / home / user中/的NetBeansProjects / erstertest&#39; &#34;在/ usr /斌/使&#34; -F nbproject / Makefile-Debug.mk dist / Debug / GNU-Linux / erstertest make [2]: 输入目录&#39; / home / user / NetBeansProjects / erstertest&#39; mkdir -p dist / Debug / GNU-Linux g ++ -o dist / Debug / GNU-Linux / erstertest build / Debug / GNU-Linux / main.o build / Debug / GNU-Linux / main.o:In function
main': /home/user/NetBeansProjects/erstertest/main.cpp:5: undefined reference to
sf :: String :: String(char const *,std :: locale 常量&安培;)&#39; /home/user/NetBeansProjects/erstertest/main.cpp:5:undefined 引用sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)' /home/user/NetBeansProjects/erstertest/main.cpp:5: undefined reference to
sf :: RenderWindow :: RenderWindow(sf :: VideoMode, sf :: String const&amp;,unsigned int,sf :: ContextSettings const&amp;)&#39; /home/user/NetBeansProjects/erstertest/main.cpp:6:未定义的引用 到sf::CircleShape::CircleShape(float, unsigned long)' /home/user/NetBeansProjects/erstertest/main.cpp:7: undefined reference to
sf :: Color :: Green&#39; /home/user/NetBeansProjects/erstertest/main.cpp:7:未定义的引用 tosf::Shape::setFillColor(sf::Color const&)' /home/user/NetBeansProjects/erstertest/main.cpp:9: undefined reference to
sf :: Window :: isOpen()const&#39; /home/user/NetBeansProjects/erstertest/main.cpp:12:undefined 引用sf::Window::pollEvent(sf::Event&)' /home/user/NetBeansProjects/erstertest/main.cpp:15: undefined reference to
sf :: Window :: close()&#39; /home/user/NetBeansProjects/erstertest/main.cpp:18:undefined 引用sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)' /home/user/NetBeansProjects/erstertest/main.cpp:18: undefined reference to
sf :: RenderTarget :: clear(sf :: Color const&amp;)&#39; /home/user/NetBeansProjects/erstertest/main.cpp:19:undefined 引用sf::RenderStates::Default' /home/user/NetBeansProjects/erstertest/main.cpp:19: undefined reference to
sf :: RenderTarget :: draw(sf :: Drawable const&amp ;,, sf :: RenderStates const&amp;)&#39; /home/user/NetBeansProjects/erstertest/main.cpp:20:undefined 引用sf::Window::display()' /home/user/NetBeansProjects/erstertest/main.cpp:5: undefined reference to
sf :: RenderWindow :: ~RenderWindow()&#39; /home/user/NetBeansProjects/erstertest/main.cpp:24:undefined 引用sf::RenderWindow::~RenderWindow()' /home/user/NetBeansProjects/erstertest/main.cpp:5: undefined reference to
sf :: RenderWindow :: ~RenderWindow()&#39;构建/调试/ GNU Linux的/ main.o: 在函数sf::CircleShape::~CircleShape()': /usr/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to
vtable for sf :: CircleShape&#39; /usr/include/SFML/Graphics/CircleShape.hpp:41:未定义的引用vtable for sf::CircleShape' /usr/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to
SF ::形状::〜式样()&#39; collect2:错误:ld返回1退出状态 nbproject / Makefile-Debug.mk:62:目标的配方 &#39; DIST /调试/ GNU Linux的/ erstertest&#39;失败了[2]: * [dist / Debug / GNU-Linux / erstertest]错误1 make [2]:离开目录 &#39; / home / user中/的NetBeansProjects / erstertest&#39; nbproject / Makefile-Debug.mk:59:目标&#39; .build-conf&#39;失败 make [1]:* [.build-conf]错误2 make [1]:离开目录 &#39; / home / user中/的NetBeansProjects / erstertest&#39; nbproject / Makefile-impl.mk:39:目标配方&#39; .build-impl&#39;失败 make:*** [.build-impl]错误2