【发布时间】:2013-03-05 13:19:29
【问题描述】:
我正在运行 Linux Mint。版本信息如下:
$ cat /etc/*-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=12
DISTRIB_CODENAME=lisa
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"
我通过下载 tar 文件、进入 sfml 文件夹并运行 sudo make install 来安装 sfml。它没有给我任何错误消息,因此假设它安装成功似乎是安全的。
我编写了this tutorial 中给出的clock.cpp 程序。我使用以下命令编译它:
$ g++ -c clock.cpp
$ g++ -o clock clock.o -lsfml-system
它没有给我任何输出,所以我认为编译进行得很好。但是当我尝试运行它时问题就开始了。这是我尝试运行时钟可执行文件的结果:
$ ./clock
./clock: error while loading shared libraries: libsfml-system.so.1.6:
cannot open shared object file: No such file or directory
我尝试了教程提供的第二个编译选项,同样的事情发生了:
$ g++ -c clock.cpp
$ g++ -o clock clock.o -lsfml-graphics -lsfml-window -lsfml-system
./clock: error while loading shared libraries: libsfml-system.so.1.6:
cannot open shared object file: No such file or directory
为什么我不能运行程序?
【问题讨论】:
-
linux发行版?
-
Linux Mint。我刚刚编辑添加了版本信息。
-
"我通过下载 tar 文件、进入 sfml 文件夹并运行 sudo make install 来安装 sfml。"你是为了问问题而缩短它吗?我认为您必须通过传统步骤:
./configure、make、sudo make install。不过,如果版本正确,我建议您使用系统的包管理器安装它们。 -
所有 *-dev 库都安装正确了吗?
apt-get build-dep libsfml制作? -
@ZettaSuro 在此之后运行:
sudo apt-get install libsfml-dev?