我尝试使用Xcode 5.1在OS X 10.9上使用GLEW设置程序,但在尝试构建它时,我收到了来自glew.h
的大量错误:
Build target HelloGL
CompileC /Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Intermediates/HelloGL.build/Debug/HelloGL.build/Objects-normal/x86_64/main.o HelloGL/main.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/rpowell/Projects/HelloGL
export LANG=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fmodules -fmodules-cache-path=/Users/rpowell/Library/Developer/Xcode/DerivedData/ModuleCache -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.9 -g -Wno-sign-conversion -I/Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Intermediates/HelloGL.build/Debug/HelloGL.build/HelloGL.hmap -I/usr/local/include -I/Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Products/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Intermediates/HelloGL.build/Debug/HelloGL.build/DerivedSources/x86_64 -I/Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Intermediates/HelloGL.build/Debug/HelloGL.build/DerivedSources -F/Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Products/Debug -MMD -MT dependencies -MF /Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Intermediates/HelloGL.build/Debug/HelloGL.build/Objects-normal/x86_64/main.d --serialize-diagnostics /Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Intermediates/HelloGL.build/Debug/HelloGL.build/Objects-normal/x86_64/main.dia -c /Users/rpowell/Projects/HelloGL/HelloGL/main.c -o /Users/rpowell/Library/Developer/Xcode/DerivedData/HelloGL-hkapwtszjscyivcyxfphwntzlxmw/Build/Intermediates/HelloGL.build/Debug/HelloGL.build/Objects-normal/x86_64/main.o
In file included from /Users/rpowell/Projects/HelloGL/HelloGL/main.c:1:
/usr/local/include/GL/glew.h:15043:17: error: declaration of 'PFNGLCOPYTEXSUBIMAGE3DPROC' must be imported from module 'OpenGL.GL3' before it is required
GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D;
^
In module 'OpenGL' imported from /usr/local/include/GL/glew.h:1186:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:1762:25: note: previous declaration is here
typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
^
In file included from /Users/rpowell/Projects/HelloGL/HelloGL/main.c:1:
/usr/local/include/GL/glew.h:15049:17: error: unknown type name 'PFNGLCLIENTACTIVETEXTUREPROC'; did you mean 'PFNGLACTIVETEXTUREPROC'?
GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
PFNGLACTIVETEXTUREPROC
In module 'OpenGL' imported from /usr/local/include/GL/glew.h:1186:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:1778:25: note: 'PFNGLACTIVETEXTUREPROC' declared here
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
^
In file included from /Users/rpowell/Projects/HelloGL/HelloGL/main.c:1:
/usr/local/include/GL/glew.h:15057:17: error: unknown type name 'PFNGLLOADTRANSPOSEMATRIXDPROC'
GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd;
^
/usr/local/include/GL/glew.h:15058:17: error: unknown type name 'PFNGLLOADTRANSPOSEMATRIXFPROC'
GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf;
^
/usr/local/include/GL/glew.h:15059:17: error: unknown type name 'PFNGLMULTTRANSPOSEMATRIXDPROC'
GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd;
^
/usr/local/include/GL/glew.h:15060:17: error: unknown type name 'PFNGLMULTTRANSPOSEMATRIXFPROC'
GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf;
^
/usr/local/include/GL/glew.h:15061:17: error: unknown type name 'PFNGLMULTITEXCOORD1DPROC'; did you mean 'PFNGLMULTITEXCOORD4XPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d;
^~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD4XPROC
/usr/local/include/GL/glew.h:13827:28: note: 'PFNGLMULTITEXCOORD4XPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4XPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
^
/usr/local/include/GL/glew.h:15062:17: error: unknown type name 'PFNGLMULTITEXCOORD1DVPROC'; did you mean 'PFNGLMULTITEXCOORD1HNVPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv;
^~~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD1HNVPROC
/usr/local/include/GL/glew.h:12047:28: note: 'PFNGLMULTITEXCOORD1HNVPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s);
^
/usr/local/include/GL/glew.h:15063:17: error: unknown type name 'PFNGLMULTITEXCOORD1FPROC'; did you mean 'PFNGLMULTITEXCOORD4XPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f;
^~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD4XPROC
/usr/local/include/GL/glew.h:13827:28: note: 'PFNGLMULTITEXCOORD4XPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4XPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
^
/usr/local/include/GL/glew.h:15064:17: error: unknown type name 'PFNGLMULTITEXCOORD1FVPROC'; did you mean 'PFNGLMULTITEXCOORD1HNVPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv;
^~~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD1HNVPROC
/usr/local/include/GL/glew.h:12047:28: note: 'PFNGLMULTITEXCOORD1HNVPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s);
^
/usr/local/include/GL/glew.h:15065:17: error: unknown type name 'PFNGLMULTITEXCOORD1IPROC'
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i;
^
/usr/local/include/GL/glew.h:15066:17: error: unknown type name 'PFNGLMULTITEXCOORD1IVPROC'
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv;
^
/usr/local/include/GL/glew.h:15067:17: error: unknown type name 'PFNGLMULTITEXCOORD1SPROC'; did you mean 'PFNGLMULTITEXCOORD4XPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s;
^~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD4XPROC
/usr/local/include/GL/glew.h:13827:28: note: 'PFNGLMULTITEXCOORD4XPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4XPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
^
/usr/local/include/GL/glew.h:15068:17: error: unknown type name 'PFNGLMULTITEXCOORD1SVPROC'; did you mean 'PFNGLMULTITEXCOORD1HNVPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv;
^~~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD1HNVPROC
/usr/local/include/GL/glew.h:12047:28: note: 'PFNGLMULTITEXCOORD1HNVPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s);
^
/usr/local/include/GL/glew.h:15069:17: error: unknown type name 'PFNGLMULTITEXCOORD2DPROC'; did you mean 'PFNGLMULTITEXCOORD4XPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d;
^~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD4XPROC
/usr/local/include/GL/glew.h:13827:28: note: 'PFNGLMULTITEXCOORD4XPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4XPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
^
/usr/local/include/GL/glew.h:15070:17: error: unknown type name 'PFNGLMULTITEXCOORD2DVPROC'; did you mean 'PFNGLMULTITEXCOORD2HNVPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv;
^~~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD2HNVPROC
/usr/local/include/GL/glew.h:12049:28: note: 'PFNGLMULTITEXCOORD2HNVPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t);
^
/usr/local/include/GL/glew.h:15071:17: error: unknown type name 'PFNGLMULTITEXCOORD2FPROC'; did you mean 'PFNGLMULTITEXCOORD4XPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f;
^~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD4XPROC
/usr/local/include/GL/glew.h:13827:28: note: 'PFNGLMULTITEXCOORD4XPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4XPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
^
/usr/local/include/GL/glew.h:15072:17: error: unknown type name 'PFNGLMULTITEXCOORD2FVPROC'; did you mean 'PFNGLMULTITEXCOORD2HNVPROC'?
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv;
^~~~~~~~~~~~~~~~~~~~~~~~~
PFNGLMULTITEXCOORD2HNVPROC
/usr/local/include/GL/glew.h:12049:28: note: 'PFNGLMULTITEXCOORD2HNVPROC' declared here
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t);
^
/usr/local/include/GL/glew.h:15073:17: error: unknown type name 'PFNGLMULTITEXCOORD2IPROC'
GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
程序本身非常简单,只是稍微修改了GLFW documentation's example code:
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
int main(void)
{
GLFWwindow* window;
// Initialize the library
if (!glfwInit())
return -1;
// Specify the minimum OpenGL version
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
// Create a windowed mode window and its OpenGL context
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
// Make the window's context current
glfwMakeContextCurrent(window);
printf("GL Version: %s", glGetString(GL_VERSION));
// Loop until the user closes the window
while (!glfwWindowShouldClose(window))
{
// Render here
glClear(GL_COLOR_BUFFER_BIT);
// Swap front and back buffers
glfwSwapBuffers(window);
// Poll for and process events
glfwPollEvents();
}
glfwTerminate();
return 0;
}
有关此项目配置的更多详细信息可能有所帮助:
YES
/usr/local/include
libGLEW.1.10.0.dylib
和libglfw.3.0.dylib
如果有人之前遇到过此问题,或者对此问题有解决方法,我非常感谢。
答案 0 :(得分:16)
好吧,一些挖掘帮助我弄清楚Clang正在抱怨什么。看起来像Xcode 5.1附带的Clang版本包括对Modules的支持;这是非常酷和有趣的解决一堆问题,但也彻底打破了GLEW。
通过将启用模块(C和目标C)构建选项设置为NO
,一切都可以像以前的版本一样工作,并且GLEW按预期工作。
答案 1 :(得分:4)