无法运行在Linux中使用sfml的程序 [英] can't run a program that uses sfml in Linux
问题描述
我正在运行Linux Mint。版本信息如下:
I am running Linux Mint. The version information is as follows:
$ cat /etc/*-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=12
DISTRIB_CODENAME=lisa
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"
我安装sfml通过下载tar文件,进入sfml文件夹,并运行 sudo make install
。
I installed sfml by downloading the tar file, going into the sfml folder, and running sudo make install
. It does not give me any error messages so it seems safe to assume that it installed successfully.
我写了一个clock.cpp程序,在本教程。我使用以下命令编译它:
I wrote the clock.cpp program given in this tutorial. I compile it using the following commands:
$ g++ -c clock.cpp
$ g++ -o clock clock.o -lsfml-system
它没有输出,所以我认为编译正常。但问题开始时,我试图运行它。这是我尝试运行时钟可执行文件的结果:
It gives me no output, so I assume that the compilation went just fine. But the problem starts when I try to run it. This is the result of me trying to run the clock executable:
$ ./clock
./clock: error while loading shared libraries: libsfml-system.so.1.6:
cannot open shared object file: No such file or directory
我尝试教程给出的第二个编译选项,同样的事情发生:
I try the second compilation option that the tutorial gives, and the same thing happens:
$ 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
为什么不能运行程序?
推荐答案
必须为libsfml安装开发库:
You must install development library for libsfml:
sudo apt-get install libsfml-dev
:
apt-get build-dep libsfml
dev版本的软件包是必需的,因为头文件是必需的
dev version of package is required because header files are necessary
这样的特殊库通常安装apt
such special libraries are usually installed with apt
这篇关于无法运行在Linux中使用sfml的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!