编译sfml c ++(ubuntu)

时间:2012-10-15 08:29:34

标签: c++ ubuntu compilation sfml

我按照this教程安装了sfml 2.0,我遇到了编译问题,我尝试过以下脚本的多种变体。我正在使用this教程中的代码。

这是我尝试做的事情

g ++ main.o -o -I / home / hassan / Development / sfml - 这个编译

然而

g ++ main.o -o -L / home / hassan / Development / sfml / lib -lsfml-graphics -lsfml-window -lsfml-system

没有

“/ usr / bin / ld:无法打开输出文件-L / home / hassan / Development / sfml /:没有这样的文件或目录”

谢谢

1 个答案:

答案 0 :(得分:1)

来自“man g ++”:

   -o file
      Place output in file file.  This applies regardless to whatever
      sort of output is being produced, whether it be an executable file,
      an object file, an assembler file or preprocessed C code. (...)

g ++的-o选项需要输出文件作为参数。所以在行

g++ main.o -o -L/home/hassan/Development/sfml/lib -lsfml-graphics -lsfml-window -lsfml-system

你告诉你把可执行文件放到文件“-L / home / hassan / Development / sfml / lib”中,这没有用。 尝试

g++ main.o -o sfml-app -L/home/hassan/Development/sfml/lib -lsfml-graphics -lsfml-window -lsfml-system