Opengl-无法识别GLfloat
Opengl - GLfloat not being recognized
由于这个类声明有一些问题,我试图为Dijktra最短路径算法的openGL实现创建节点。getX()、getY()和getZ()方法导致错误:
错误:ISO C++禁止声明没有类型的"getX"
我在ubuntu-linux上使用g++进行编译。命令:g++-lglut-lGLU-lGL项目测试.c
#include <cstdarg>
#include <cstdio>
#include <GL/glut.h>
#include <GL/glu.h>
#include <cstdlib>
#include <iostream>
#define kWindowWidth 800
#define kWindowHeight 600
#define NUM_NODES 3
using namespace std;
class Node {
private:
GLfloat x, y, z;
int numLinks;
Node *links[];
public:
Node(GLfloat x, GLfloat y, ...);
~Node();
GLfloat getX();
GLfloat getY();
GLfloat getZ() {return 0.0f;}
} Node;
Node nodes_g[NUM_NODES];
我认为问题出在预处理器宏中。我是openGL的新手,对c++也有点陌生,所以任何建议都很好,但我真正想知道的是我为什么会出错。
您需要
#include <GL/gl.h>
在包括OpenGL扩展的头之前。
如果您有
#include <GL/glut.h>
那么您不应该需要GL/GL.h或GL/glu.h,尽管您可能必须将cstdlib放在GL/glus.h
相关文章:
- 提升 ASIO 无法识别计时器对象
- 从udp接收帧对于人脸识别来说太慢
- 模板类无法识别友元运算符
- std::visit无法识别类型
- 无法识别模板功能
- 我有两个类需要在同一 cpp 文件中相互引用,但第一个类无法识别第二个类类型的对象
- 如何在LLVM中dyn_cast以识别StoreInst?
- 从不同的附加依赖项中识别等同命名的函数
- C++出现控制台错误.我无法识别源代码的问题
- VSCode IntelliSense无法识别SDL框架的SDL_image扩展库
- C++数组中的 GLFloat 数组
- Qt:"Q3DScatter"即使包含在内也无法识别
- 使用指针的类识别
- 如何静态识别动态堆分配?
- 为什么C++无法识别我的对象实例化?
- C++ 无法识别创建进程'telnet'
- 识别 2D 矢量C++中的位置
- 如何识别项目是 QT 中的文件还是文件夹
- ESP32 无法识别任何设备已连接到其接入点
- Opengl-无法识别GLfloat