c-MAC 10.7:gl.h文件在哪里



可能的重复:
Mac OS X Lion 上的FreeGLUT

第一个问题:有人能解释一下为什么我在mac上的任何地方都找不到gl.h文件吗?!如果这个问题可以简单地回答,也许你甚至不必阅读其余的,但我在网上找不到任何答案(经过数小时的研究),除了著名的"它集成到操作系统中"或类似的东西。


我的问题详细说明:

我在使用OpenGL编译.c文件时遇到问题。我在网上浏览了好几个小时都没有找到任何解决办法。问题是:

对于那些知道这个软件的人,我正在使用Webots(一个机器人模拟软件),我想实现一个物理插件。我从一个已经存在(并且正在运行)的插件中复制了代码,只是为了尝试一下。我使用webots进行编译,它使用gcc(我不得不安装一个gcc编译器,因为它不再附带Xcode)。

现在,问题是.c文件包含一个"physics.h"头,其中包含OpenGL/gl.h文件,然后我得到错误:"OpenGL/gl.h。没有这样的文件或目录"。

现在我已经尝试了很多东西:

  • 搜索gl.h:它似乎不存在(我手动或使用finder搜索功能都找不到)

  • 用GLUT/glus.h替换include OpenGL/gl.h:我得到错误"gl.h和glu.h没有这样的文件或目录",因为它们包含在GLUT.h 中

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

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

由于OpenGL和GLUT本应与操作系统一起安装(我使用的是Lion 10.7.5),我想每个需要的文件都应该在那里。为此,我找不到下载这个假定丢失的文件的方法。。。

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

我认为我的问题在于Makefile或physic.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 */

生成文件:

###
### 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

p.S:在"my_contact_p_physics.c"(我正在努力编译的.c文件)中,我只包含一个ODE/ODE.h文件和一个具有绝对路径的physics.h文件。我无法在终端中编译directy,因为ODE"集成"到了webot中,这也是我直接在webot中编译的原因。

gl.h在那里,好吧-就在/System/Library/Frameworks/OpenGL.framework/Headers中。使用-framework OpenGL,或将-I /System/Library/Frameworks/OpenGL.framework/Headers添加到编译器标志中。假设你的文件在那里(默认情况下是这样),你应该找到它,一切都应该正常!

最新更新