这似乎是一个SDL1.2项目。不需要所有这些SDL2包。
该项目存在多个问题:
-
Makefile
应该在使用
pkg-config
在Linux上(或者由更像CMake这样的元代码生成),而不是
sdl-config
-l
旗帜。固定的:
CXXFLAGS=-pipe -Wall $(OPTIMIZE) $(DEBUG) `pkg-config --cflags sdl SDL_mixer SDL_ttf zlib` -DPREFIX=L\"$(PREFIX)\" $(PROFILER)
LNFLAGS=`pkg-config --libs sdl SDL_mixer SDL_ttf zlib` $(PROFILER)
-
这个
$(TARGET)
链接器选项位于错误的位置(之前
$(OBJECTS)
$(TARGET): $(OBJECTS)
$(CXX) $(OBJECTS) $(LNFLAGS) -o $(TARGET)
-
所有的
#include <SDL/*>
线应该是领先的
SDL/
pkg-config --cflags
产生
-I/usr/include/SDL
,不是
-I/usr/include
.
应用了所有这些修复程序后,它就构建在这个Ubuntu 16.04安装上。
完整补丁:
diff --git a/Makefile b/Makefile
index e682bb1..08f5463 100644
--- a/Makefile
+++ b/Makefile
@@ -16,8 +16,8 @@ PREFIX=/usr/local
OPTIMIZE=#-O6 -march=pentium4 -mfpmath=sse -fomit-frame-pointer -funroll-loops
PROFILER=#-pg
DEBUG=#-ggdb
-CXXFLAGS=-pipe -Wall $(OPTIMIZE) $(DEBUG) `sdl-config --cflags` -DPREFIX=L\"$(PREFIX)\" $(PROFILER)
-LNFLAGS=-pipe -lSDL_ttf -lfreetype `sdl-config --libs` -lz -lSDL_mixer $(PROFILER)
+CXXFLAGS=-pipe -Wall $(OPTIMIZE) $(DEBUG) `pkg-config --cflags sdl SDL_mixer SDL_ttf zlib` -DPREFIX=L\"$(PREFIX)\" $(PROFILER)
+LNFLAGS=`pkg-config --libs sdl SDL_mixer SDL_ttf zlib` $(PROFILER)
INSTALL=install
TARGET=einstein
@@ -49,7 +49,7 @@ all: $(TARGET)
$(TARGET): $(OBJECTS)
- $(CXX) $(LNFLAGS) $(OBJECTS) -o $(TARGET)
+ $(CXX) $(OBJECTS) $(LNFLAGS) -o $(TARGET)
clean:
rm -f $(OBJECTS) core* *core $(TARGET) *~
diff --git a/font.h b/font.h
index 40d617b..2e8e44d 100644
--- a/font.h
+++ b/font.h
@@ -3,7 +3,7 @@
#include <string>
-#include <SDL/SDL_ttf.h>
+#include <SDL_ttf.h>
class Font
diff --git a/iconset.h b/iconset.h
index 4faf055..0f971ac 100644
--- a/iconset.h
+++ b/iconset.h
@@ -2,7 +2,7 @@
#define __ICONSET_H__
-#include <SDL/SDL.h>
+#include <SDL.h>
class IconSet
diff --git a/main.cpp b/main.cpp
index d103861..2d4c33f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,8 +1,8 @@
#include <stdlib.h>
#include <iostream>
-#include <SDL/SDL.h>
-#include <SDL/SDL_main.h>
-#include <SDL/SDL_ttf.h>
+#include <SDL.h>
+#include <SDL_main.h>
+#include <SDL_ttf.h>
#include "main.h"
#include "utils.h"
#include "storage.h"
diff --git a/screen.cpp b/screen.cpp
index a64dd31..7e48934 100644
--- a/screen.cpp
+++ b/screen.cpp
@@ -1,4 +1,4 @@
-#include <SDL/SDL.h>
+#include <SDL.h>
#include "screen.h"
#include "exceptions.h"
#include "unicode.h"
diff --git a/screen.h b/screen.h
index 12e99ab..2b5253d 100644
--- a/screen.h
+++ b/screen.h
@@ -2,7 +2,7 @@
#define __SCREEN_H__
-#include "SDL/SDL.h"
+#include "SDL.h"
#include <vector>
#include <list>
diff --git a/sound.cpp b/sound.cpp
index 3725245..998245f 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -1,7 +1,7 @@
#include "sound.h"
#include <iostream>
-#include <SDL/SDL_events.h>
+#include <SDL_events.h>
#include "resources.h"
diff --git a/sound.h b/sound.h
index 44e587e..dc2a449 100644
--- a/sound.h
+++ b/sound.h
@@ -4,7 +4,7 @@
#include <string>
#include <map>
-#include <SDL/SDL_mixer.h>
+#include <SDL_mixer.h>
class Sound
diff --git a/utils.h b/utils.h
index f4188cb..9ce7cb1 100644
--- a/utils.h
+++ b/utils.h
@@ -1,7 +1,7 @@
#ifndef __UTILS_H__
#define __UTILS_H__
-#include <SDL/SDL.h>
+#include <SDL.h>
#include <string>
#ifdef WIN32
#include <sys/time.h>
diff --git a/widgets.h b/widgets.h
index ce417ba..0bd7753 100644
--- a/widgets.h
+++ b/widgets.h
@@ -4,7 +4,7 @@
#include <string>
#include <list>
#include <set>
-#include <SDL/SDL.h>
+#include <SDL.h>
#include "font.h"