2012-10-10 71 views
2

可能重复:
FreeGLUT on Mac OS X LionMAC 10.7:gl.h文件在哪里?

首先QUIZZ:任何人都可以只请解释一下我为什么我不能够找到gl.h文件我的Mac上的任何地方!如果这个问题可以简单地回答,也许你甚至不需要阅读其余的内容,但是我在网上找不到任何答案(经过几小时的研究),除了着名的“它被集成到操作系统中”或类似的东西。


我的问题详细:

我有使用OpenGL .c文件的编制问题。我已经浏览了几个小时而没有找到任何解决方案。这是问题:

对于那些知道这个软件,我使用Webots(一个机器人模拟软件),我想实现一个物理插件。我从已经存在的(和工作)插件复制代码,只是为了试用它。我正在编译使用gcc的webots(我不得不安装gcc编译器,因为它不再与Xcode一起提供)。

现在,问题是.c文件包含一个“physics.h”头文件,其中包含OpenGL/gl.h文件,然后我得到错误:“OpenGL/gl.h。no such file or directoy ”。

现在,我已经尝试了许多事情:

  • 做了gl.h搜索:现在看来,这doean't存在(我无法找到它,手动或使用取景器搜索功能)

  • 葡萄糖转运/ glut.h更换包括的OpenGL/gl.h:我得到的错误“gl.h和glu.h没有这样的FIL或目录”列入glut.h因为他们的

  • 链接gl库中的makefile和框架以及

  • 可能是所有这些组合,使用绝对或相对路径!

由于OpenGL和GLUT都应该为能与操作系统进行本地安装的(我使用狮子10.7.5)我想每一个需要的文件应该在那里。而对于这个重做,我找不到方法来下载这个假设丢失的文件...

此外,我的一位同事试图在Linux上成功编译它! Linux是一个很好的平台,但我仍然喜欢我的Mac,所以请让我希望有另一种解决方案,而不是改变为Linux!

我认为我的问题在于Makefile或物理。.h文件,所以在这里,他们是:

Physic.h

#ifndef PHYSICS_H 
#define PHYSICS_H 
#include <ode/ode.h> 
#ifdef WIN32 
#include <windows.h> 
#endif 
#ifndef MACOS 
#include <GL/gl.h> 
#else 
#include <OpenGL/gl.h> 
#endif 

/* callback functions to be implemented in your physics plugin */ 
#ifdef __cplusplus 
extern "C" { 
#endif 
#ifdef _MSC_VER 
#define DLLEXPORT __declspec(dllexport) 
#else 
#define DLLEXPORT 
#endif 
DLLEXPORT void webots_physics_init(dWorldID,dSpaceID,dJointGroupID); 
DLLEXPORT int webots_physics_collide(dGeomID,dGeomID); 
DLLEXPORT void webots_physics_step(); 
DLLEXPORT void webots_physics_step_end(); 
DLLEXPORT void webots_physics_cleanup(); 
DLLEXPORT void webots_physics_draw(); 
DLLEXPORT void webots_physics_predraw(); 

/* utility functions to be used in your callback functions */ 
#ifndef LINUX 
extern dGeomID (*dWebotsGetGeomFromDEFProc)(const char *); 
extern dBodyID (*dWebotsGetBodyFromDEFProc)(const char *); 
extern void (*dWebotsSendProc)(int,const void *,int); 
extern void* (*dWebotsReceiveProc)(int *); 
extern void (*dWebotsConsolePrintfProc)(const char *, ...); 
extern double (*dWebotsGetTimeProc)(); 
#define dWebotsGetGeomFromDEF(DEFName) (*dWebotsGetGeomFromDEFProc)(DEFName) 
#define dWebotsGetBodyFromDEF(DEFName) (*dWebotsGetBodyFromDEFProc)(DEFName) 
#define dWebotsSend(channel,buff,size) (*dWebotsSendProc)(channel,buff,size) 
#define dWebotsReceive(size_ptr)   (*dWebotsReceiveProc)(size_ptr) 

#if defined(__VISUALC__) || defined (_MSC_VER) || defined(__BORLANDC__) 
#define dWebotsConsolePrintf(format, ...) (*dWebotsConsolePrintfProc)(format, __VA_ARGS__) 
#else 
#define dWebotsConsolePrintf(format, ...) (*dWebotsConsolePrintfProc)(format, ## __VA_ARGS__) 
#endif 

#define dWebotsGetTime()     (*dWebotsGetTimeProc)() 
#else 
dGeomID dWebotsGetGeomFromDEF(const char *DEFName); 
dBodyID dWebotsGetBodyFromDEF(const char *DEFName); 
void dWebotsSend(int channel,const void *buffer,int size); 
void *dWebotsReceive(int *size); 
void dWebotsConsolePrintf(const char *format, ...); 
double dWebotsGetTime(); 
#endif 
#ifdef __cplusplus 
} 
#endif 

#endif /* PHYSICS_H */ 

的Makefile:

### 
### Standard Makefile for Webots physics plugins 
### 
### Supported platforms: Windows, Mac OS X, Linux 
### Supported languages: C, C++ 
### 
### Authors: Olivier Michel - www.cyberbotics.com 
### Revised: Yvan Bourquin - September 30th, 2009. 
### 
### Uncomment the variables to customize the Makefile 

### -----C Sources----- 
### 
### if your plugin uses several C source files: 
C_SOURCES = my_contact_p_physics.c 

### -----C++ Sources----- 
### 
### if your plugin uses several C++ source files: 
# CPP_SOURCES = my_plugin.cpp my_clever_algo.cpp my_graphics.cpp 
###  or 
# CC_SOURCES = my_plugin.cc my_clever_algo.cc my_graphics.cc 

FRAMEWORK = -framework OpenGL -framework GLUT 

### -----Options----- 
### 
### if special CFLAGS are necessary, for example to set optimization level or 
### to find include files: 
#CFLAGS=-O3 -I/System/Library/Frameworks/OpenGL.framework 
### 
### if your plugin needs additional libraries: 
LIBRARIES=-L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries -llibGL -llibGLU 


### Do not modify: this includes Webots global Makefile.include 
space := 
space += 
WEBOTS_HOME_PATH=$(subst $(space),\ ,$(strip $(subst \,/,$(WEBOTS_HOME)))) 
include $(WEBOTS_HOME_PATH)/resources/projects/default/plugins/physics/Makefile.include 

PS:在 “my_contact_p_physics.c”(.c文件我试图很难编译)我只是包含一个ODE/ode.h文件和physics.h文件的绝对路径。我无法在终端中编译directy,因为它可以“集成”到网络中,因此我直接在网络中编译。

+0

您需要将OpenGL框架添加到您的项目中。 – datenwolf

+0

这不是由我在我的Makefile中写的内容完成的吗?即:框架:-framework OpenGL – Wat

回答

5

gl.h在那里,好吧 - 只需在/System/Library/Frameworks/OpenGL.framework/Headers。可以使用-framework OpenGL,或者将-I /System/Library/Frameworks/OpenGL.framework/Headers添加到编译器标志中。假设你的文件在那里(默认情况下),你应该找到它,并且都应该工作!

+1

感谢您的回答。我其实已经看过OpenGL.framework,但事情是我没有“Headers”目录。我只有Version/A /,并且在那里有“_CodeSignature”,“Libraries”(包含一些OpenGL库,但没有头文件),OpenGL(可执行文件),“Plugins”目录,“Resources”目录。它们都不包含任何头文件。你认为卸载并重新安装Xcode可以提供帮助吗?顺便说一下,我在GLUT.framework中有一个头文件directoery,但只有glut.h在那里(它包含gl.h和glu.h) – Wat