gpt4 book ai didi

c++ - declaration does not declare anything [-fpermissive] 错误

转载 作者:行者123 更新时间:2023-11-30 00:51:53 36 4
gpt4 key购买 nike

我收到“decleration does not declare anything [-fpermissive] 错误”;这是我的代码;

#ifndef CAMERA_H
#define CAMERA_H
#include "Vector.h"
#include <string>

using namespace std;

class Camera
{
private:
int id;
float position[3];
Vector gaze;
Vector up;
float left;
float right;
float bottom;
float top;
float near;
float far;
int type;

public:
Camera(int i,string c, string g, string u, string f, string t);
int getID() {return id; }
float* getPosition() { return position; }
Vector getGaze() { return gaze; }
Vector getUp() { return up; }
float getLeft() {return left;}
float getRight() {return right;}
float getBottom() {return bottom;}
float getTop() {return top;}
float getNear() {return near;}
float getFar() {return far;}
int getType() {return type;}
};

#endif // CAMERA_H

错误从“float near;”开始并继续接下来的 3 行。

此错误的原因是什么,我该如何解决。

最佳答案

nearfar 替换为其他内容,至少对于测试而言,例如near_far_:我怀疑您正在使用一些有趣的 header 进行编译,这些 header 将 nearfar 定义为空。在遥远的过去,这两个是一些平台上用于处理不同大小指针的关键字。

如果你想验证理论,用-E选项处理源文件(你可能需要从编译行中删除其他选项,例如,-c): 使用此选项编译器生成预处理输出。如果您捕获它并查看您的类,我很确定它不会包含成员名称。

关于c++ - declaration does not declare anything [-fpermissive] 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20434723/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com