[英]compiling sfml c++ (ubuntu)
I followed this tutorial for installing sfml 2.0 and I am having issues compiling, I have tried many variations of the scripts below. 我按照此教程安装了sfml 2.0,并且在编译时遇到问题,我尝试了以下脚本的多种变体。 I am using the code in this tutorial.
我正在使用本教程中的代码。
this is what I tried doing 这就是我尝试做的
g++ main.o -o -I/home/hassan/Development/sfml --this compiles g ++ main.o -o -I / home / hassan / Development / sfml-编译
however 然而
g++ main.o -o -L/home/hassan/Development/sfml/lib -lsfml-graphics -lsfml-window -lsfml-system g ++ main.o -o -L / home / hassan / Development / sfml / lib -lsfml-graphics -lsfml-window -lsfml-system
does not 才不是
"/usr/bin/ld: cannot open output file -L/home/hassan/Development/sfml/: No such file or directory" “ / usr / bin / ld:无法打开输出文件-L / home / hassan / Development / sfml /:没有这样的文件或目录”
thank you 谢谢
From "man g++": 来自“ 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. (...)
The -o option of g++ expects an output file as parameter. g ++的-o选项期望将输出文件作为参数。 So in the line
所以在行
g++ main.o -o -L/home/hassan/Development/sfml/lib -lsfml-graphics -lsfml-window -lsfml-system
you are telling to put the executable into the file "-L/home/hassan/Development/sfml/lib", which does not really make sense. 您正在告诉将可执行文件放入文件“ -L / home / hassan / Development / sfml / lib”,这实际上没有任何意义。 Try
尝试
g++ main.o -o sfml-app -L/home/hassan/Development/sfml/lib -lsfml-graphics -lsfml-window -lsfml-system
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.