【发布时间】:2018-09-24 08:20:32
【问题描述】:
当我想使用时我需要链接哪些库 我有
if(! sb.loadFromFile("Intro.wav")){
exit(-1);
}
intro.setBuffer(sb);
intro.setLoop(true);
intro.play();
我试过了
g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio Menu.o
但是编译器会抛出类似的错误
undefined reference to `sf::SoundBuffer::SoundBuffer()'
undefined reference to `sf::Sound::Sound()'
【问题讨论】:
-
订单可能很重要。试着把
sfml-system放在最后。或先Menu.o。或使用$(pkg-config sfml-all --libs) -
你能发布你用来编译/链接的完整命令吗?
-
非常感谢。 $(pkg-config sfml-all --libs) 有效。