我正在尝试构建 Cube2 Sauerbraten,但我需要 OpenGL 和 SDL2 库来运行 makefile。(我在这里使用 ubuntu)我尝试运行sudo apt-get install --yes software-properties-common g++ make
然后sudo apt-get install --yes libsdl2-dev
最后sudo apt-get install --yes freeglut3-dev
,编译,g++ main.cpp -I /usr/include/SDL2/ -lSDL2 -lGL
.
我从https://gist.github.com/dirkk0/cad259e6a3965abb4178获得了这些命令。当我运行它们时,前三个命令工作正常,但最后一个没有工作,给了我这个错误。
optiplex780@super-OptiPlex-780:~$ g++ main.cpp -I /usr/include/SDL2/ -lSDL2 -lGL
cc1plus: fatal error: main.cpp: No such file or directory
compilation terminated.
optiplex780@super-OptiPlex-780:~$
我应该用makefile替换main.cpp吗?
我只是个笨蛋,还是这里有问题?安装软件包后,我尝试进入~/sauerbraten/src
目录并运行make install
. 我得到了这些错误。
optiplex780@super-OptiPlex-780:~/sauerbraten_2020_12_29_linux/sauerbraten/src$ make install
make -C enet/ all
make[1]: Entering directory '/home/optiplex780/sauerbraten_2020_12_29_linux/sauerbraten/src/enet'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/optiplex780/sauerbraten_2020_12_29_linux/sauerbraten/src/enet'
g++ -O3 -fomit-frame-pointer -Wall -fsigned-char -o sauer_client shared/crypto.o shared/geom.o shared/stream.o shared/tools.o shared/zip.o engine/3dgui.o engine/bih.o engine/blend.o engine/blob.o engine/client.o engine/command.o engine/console.o engine/cubeloader.o engine/decal.o engine/dynlight.o engine/glare.o engine/grass.o engine/lightmap.o engine/main.o engine/material.o engine/menus.o engine/movie.o engine/normal.o engine/octa.o engine/octaedit.o engine/octarender.o engine/physics.o engine/pvs.o engine/rendergl.o engine/rendermodel.o engine/renderparticles.o engine/rendersky.o engine/rendertext.o engine/renderva.o engine/server.o engine/serverbrowser.o engine/shader.o engine/shadowmap.o engine/sound.o engine/texture.o engine/water.o engine/world.o engine/worldio.o fpsgame/ai.o fpsgame/client.o fpsgame/entities.o fpsgame/fps.o fpsgame/monster.o fpsgame/movable.o fpsgame/render.o fpsgame/scoreboard.o fpsgame/server.o fpsgame/waypoint.o fpsgame/weapon.o -Lenet/.libs -lenet -L/usr/X11R6/lib `sdl-config --libs` -lSDL_image -lSDL_mixer -lz -lGL -lrt
/bin/sh: 1: sdl-config: not found
/usr/bin/ld: cannot find -lSDL_image
/usr/bin/ld: cannot find -lSDL_mixer
collect2: error: ld returned 1 exit status
make: *** [Makefile:163: client] Error 1
optiplex780@super-OptiPlex-780:~/sauerbraten_2020_12_29_linux/sauerbraten/src$