我正在尝试将SFML编译到android上,并且正在关注this tutorial。我在Ubuntu 64位上安装。我能够运行cmake命令。但是当我在它之后运行make,它正在构建标题(或者其他东西)时,我得到了这个错误:
In file included from /home/engineer/Desktop/SFML/src/SFML/Graphics/GLCheck.hpp:32:0,
from /home/engineer/Desktop/SFML/src/SFML/Graphics/Texture.cpp:30:
/home/engineer/Desktop/SFML/src/SFML/Graphics/Texture.cpp: In member function 'bool sf::Texture::create(unsigned int, unsigned int)':
/home/engineer/Desktop/SFML/src/SFML/Graphics/GLExtensions.hpp:114:55: error: 'GL_EXT_sRGB' was not declared in this scope
#define GLEXT_texture_sRGB GL_EXT_sRGB
^
/home/engineer/Desktop/SFML/src/SFML/Graphics/Texture.cpp:190:31: note: in expansion of macro 'GLEXT_texture_sRGB'
static bool textureSrgb = GLEXT_texture_sRGB;
^
In file included from /home/engineer/Desktop/SFML/src/SFML/Graphics/Texture.cpp:30:0:
/home/engineer/Desktop/SFML/src/SFML/Graphics/GLExtensions.hpp:115:55: error: 'GL_SRGB8_ALPHA8_EXT' was not declared in this scope
#define GLEXT_GL_SRGB8_ALPHA8 GL_SRGB8_ALPHA8_EXT
^
/home/engineer/Desktop/SFML/src/SFML/Graphics/GLCheck.hpp:51:28: note: in definition of macro 'glCheck'
#define glCheck(expr) (expr)
^
/home/engineer/Desktop/SFML/src/SFML/Graphics/Texture.cpp:213:54: note: in expansion of macro 'GLEXT_GL_SRGB8_ALPHA8'
glCheck(glTexImage2D(GL_TEXTURE_2D, 0, (m_sRgb ? GLEXT_GL_SRGB8_ALPHA8 : GL_RGBA), m_actualSize.x, m_actualSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
^
src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/build.make:353: recipe for target 'src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Texture.cpp.o' failed
make[2]: ** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Texture.cpp.o] Error 1
CMakeFiles/Makefile2:343: recipe for target 'src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/all' failed
make[1]: ** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
所以基本上它有一个cpp文件中包含的宏的问题。在遇到错误之前,make会达到64%。
答案 0 :(得分:0)
您可以在此期间尝试this patch:
From c89d1a987bc8358ea87c56c5aac5f25e4fec8e2d Mon Sep 17 00:00:00 2001
From: Gordon McShane <gordonmcshane@gmail.com>
Date: Mon, 4 Apr 2016 11:56:16 -0700
Subject: [PATCH] Fix OpenGL ES compilation issues for Android
-Disable OpenGL ES 3.0 extensions on Android
---
src/SFML/Graphics/GLExtensions.hpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/SFML/Graphics/GLExtensions.hpp b/src/SFML/Graphics/GLExtensions.hpp
index b63ea99..3acb6c3 100644
--- a/src/SFML/Graphics/GLExtensions.hpp
+++ b/src/SFML/Graphics/GLExtensions.hpp
@@ -110,9 +110,14 @@
#define GLEXT_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
#define GLEXT_GL_INVALID_FRAMEBUFFER_OPERATION GL_INVALID_FRAMEBUFFER_OPERATION_OES
- // Core since 3.0 - EXT_sRGB
+#ifdef SFML_SYSTEM_ANDROID
+ #define GLEXT_texture_sRGB false
+ #define GLEXT_GL_SRGB8_ALPHA8 false
+#else
+ // Core since 3.0 - EXT_sRGB
#define GLEXT_texture_sRGB GL_EXT_sRGB
#define GLEXT_GL_SRGB8_ALPHA8 GL_SRGB8_ALPHA8_EXT
+#endif
#else