2013-12-21 27 views
0

爲什麼此代碼給我一個關於標識符GLUquadric的錯誤?據我所知,GLFW包括應該將其納入範圍。錯誤CC2061:語法錯誤:標識符'GLUquadric'

#ifndef BALL_H 
#define BALL_H 

#define GLFW_INCLUDE_GLU 
#include <GLFW/glfw3.h> 

#include <glm/glm.hpp> 
#include <glm/ext.hpp> 

struct Cuboid; 

struct Ball { 
    glm::vec3 position; 
    glm::vec3 velocity; 
    float radius; 

    glm::quat orientation; 
    glm::vec3 angular_velocity; 

    Ball(float radius); 
}; 

void draw(const Ball& ball, GLUquadric* quadric); 
void integrate(Ball& ball, float dt, const Cuboid& platform, glm::vec3 torque); 

#endif 
+0

請更新您的問題以顯示確切的完整錯誤信息。 –

回答

0

我自己想出瞭解決方案。看起來像包含Ball.h(我發佈的那個)的.cpp文件已經包含GLFW/glfw3.h,但事先沒有#define GLFW_INCLUDE_GLU。我解決它通過添加在.cpp文件一個定義,但我想,也許我更好的解決方案可以通過使我自己的頭,opengl.h做到:

#ifndef OPENGL_H 
#define OPENGL_H 

#define GLFW_INCLUDE_GLU 
#include <GLFW/glfw3.h> 

#endif 

然後包括代替GLFW/glfw3.h

相關問題