2012-10-10 2 views
2

가능한 중복 :
FreeGLUT on Mac OS X LionMAC 10.7 : gl.h 파일은 어디에 있습니까?

먼저 quizz : 사람이 그냥 날을 설명해주십시오 수없는 이유입니다 나는 내 Mac에서 아무 곳이나 gl.h 파일을 찾을 수 없습니다?! 이 질문에 단순히 대답 할 수 있다면 나머지 부분을 읽지 않아도 될 것입니다. 그러나 유명한 "it 's in the os"를 제외하고 웹에서 그 답변을 찾을 수는 없었습니다 (수 시간의 연구 후). 그런 식으로. 상세


내 문제 :

내가 OpenGL을을 사용하여 .c 파일의 편집에 문제를있다. Ihave는 솔루션을 찾지 않고 몇 시간 동안 웹을 탐색했습니다. 여기에 문제가 있습니다 :

이 소프트웨어를 아는 사람들에게는 Webots (로봇 시뮬레이션 소프트웨어)를 사용하고 있으며 물리 플러그인을 구현하고 싶습니다. 나는 이미 존재하는 (그리고 작동하는) 플러그인의 코드를 복사 해 보았습니다. gcc를 사용하는 webots로 컴파일 중입니다. (gcc 컴파일러를 설치해야했기 때문에 Xcode가 더 이상 필요하지 않습니다.)

이제 문제는 .c 파일에 OpenGL/gl.h 파일을 포함하는 "physics.h"헤더가 포함되어 있으며 다음과 같은 오류가 발생합니다. "OpenGL/gl.h. 해당 파일이나 directoy가 없습니다. ".

지금은 여러 가지로 시도했다 :

  • 이 gl.h에 대한 검색을 : 존재 doean't 것 (I 수동으로 또는 파인더 검색으로 찾을 수 없습니다 기능)

  • GLUT/glut.h하여 포함 OpenGL을가/gl.h를 교체 : 나는 오류 "gl.h을하고 그런 FIL 또는 디렉토리 glu.h 없다"얻을 glut.h에 포함 된 자신의 이후를

  • 또한 메이크 파일과 프레임 워크에서 gl 라이브러리를 연결합니다.

  • 아마도 절대 경로 또는 상대 경로를 사용하는 이들의 모든 조합!

    는 OpenGL과 GLUT 이후

는 기본적으로 OS로 설치 해야하는 나는 모든 필요한 파일이 있어야한다 생각 (I 라이온 10.7.5를 사용하여 오전). 그리고이 reaon에 대한이 파일을 잃어버린이 파일을 다운로드 할 수있는 방법을 찾을 수 없습니다 ...

또한 동료가 시도하고 리눅스에서 성공적으로 컴파일! 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 

PS : 나는은 "my_contact_p_physics.c"에서합니다 (.c 파일을 오전 너무 열심히 컴파일하려고 함) ODE/ode.h 파일과 physics.h 파일을 절대 경로와 함께 포함하기 만하면됩니다. 나는 Webot에 "통합"된 ODE 때문에 웹 사이트에서 직접 컴파일하는 이유 때문에 터미널에서 지시문을 컴파일 할 수 없습니다.

+0

프로젝트에 OpenGL 프레임 워크를 추가해야합니다. – datenwolf

+0

그리고 이것은 내 Makefile에 쓴 것만으로 끝나지 않습니까? 즉, : FRAMEWORK : -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"디렉토리가 없습니다. 나는 버전/A /를 가지고 있으며 거기에 "_CodeSignature", "라이브러리"(일부 OpenGL 라이브러리는 있지만 머리글 없음), OpenGL (실행 파일), "Plugins"디렉토리, "Resources"디렉토리가 있습니다. 그들 중 누구도 헤더 파일을 포함하지 않습니다. Xcode를 제거하고 다시 설치하면 도움이 될 것이라고 생각하십니까? 그런데 GLUT.framework에 Headers 지시어가 있지만 glut.h 만 있으면 거기에 있습니다 (gl.h와 glu.h를 포함합니다). – Wat

관련 문제