C++-错误 C3646:未知的覆盖说明符 [英] c++ - error C3646: unknown override specifier

查看:39
本文介绍了C++-错误 C3646:未知的覆盖说明符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我修改了我的项目,编译后弹出了一些奇怪的错误.

I modified my project and after compiling there pop up some weird error.

#ifndef BART_RAY_TRACER_MESH_H
#define BART_RAY_TRACER_MESH_H

#include <vector>
#include "assert.h"
#include "vec3f.h"

class Triangle;

class Mesh {
public:
    uint32_t nverts;
    bool _is_static;
    vec3f *verts;
    vec3f *_verts_world;
    Material material; 
    // 2 error occurs at the line below
    Matrix4x4 _trans_local_to_world; // '_trans_local_to_world': unknown override specifier & missing type specifier - int assumed. Note: C++ does not support default-int
    Matrix4x4 _trans_local_to_world_inv;
    TransformHierarchy *_trans_hierarchy;   

    std::vector<Triangle* > triangles;
    // ...
};
#endif

当我稍微改变声明的顺序时,错误总是出现在Material material之后的行,但有不同的消息:

When I change the order of the declaration a little bit, the error always occurs the line after Material material, but with different message:

#ifndef BART_RAY_TRACER_MESH_H
#define BART_RAY_TRACER_MESH_H

#include <vector>
#include "assert.h"
#include "vec3f.h"

class Triangle;

class Mesh {
public:
    uint32_t nverts;
    bool _is_static;
    vec3f *verts;
    vec3f *_verts_world;
    Material material; 
    // 2 error occurs at the line below
    TransformHierarchy *_trans_hierarchy; // error C2143: syntax error: missing ';' before '*' & error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    Matrix4x4 _trans_local_to_world;
    Matrix4x4 _trans_local_to_world_inv;  

    std::vector<Triangle* > triangles;
    // ...
};
#endif

我在 SO 上搜索过类似的问题,但似乎没有一个有用.我已经检查了我的 vec3fTriangle 类定义,以防缺少分号但我找不到任何分号.

I've searched for similar questions on SO but none seems useful. I've checked my vec3f, Triangle class definition in case there are missing semicolons but I can't find any.

有人可以帮忙吗?

推荐答案

这只是 Microsoft 的另一个错误.本质上是这样的:

This is just another Microsoft cock-up. Here it is in essence:

class C
  {
  x y ;
  } ;

如果你把它提交给像 g++ 这样的合理编译器,它会给你一条有用的错误信息:

If you submit this to a sensible compiler like g++, it gives you a helpful error message:

3:2: 错误:'x' 没有命名类型

3:2: error: 'x' does not name a type

另一方面,MSVC 提出了这个胡言乱语:

MSVC, on the other hand, comes up with this gibberish:

(3):错误 C3646:'y':未知覆盖说明符
(3):错误 C4430:缺少类型说明符 - 假定为 int.注意:C++ 没有支持 default-int

(3): error C3646: 'y': unknown override specifier
(3): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

使用此密钥,您可以将 Microsoft 的错误消息解密为:

With this key, you can decrypt Microsoft's error message into:

错误:'Matrix4x4' 未命名类型

error: 'Matrix4x4' does not name a type

这篇关于C++-错误 C3646:未知的覆盖说明符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆