小编val*_*ari的帖子

编译器错误C2653:不是类或命名空间名称

所以我最近在使用Visual C++ 2012时遇到了这个非常令人沮丧的问题.直到几个小时前,我编写的代码很好,一切都按预期工作,直到我决定优化一些东西并删除一些类.我修复了由此引发的所有错误,例如false包括等等.不幸的是,在此之后VS编译器发疯了.它开始给我错误,如:

Error 14 error C2653: 'Class' : is not a class or namespace name
Run Code Online (Sandbox Code Playgroud)

甚至

Error 5 error C2143: syntax error : missing ';' before '}'
Error 4 error C2059: syntax error : '>'
Run Code Online (Sandbox Code Playgroud)

我已经多次检查了,一切都在它的正确位置:包括所有标题,所有符号放在它们应该的位置.

据我所知,问题不在于我的代码,而在于编译器本身......我想,Visual Studio有时会非常烦人.无论如何,如果有人能帮我解决这个问题,我真的很感激.

(顺便说一句,禁用预编译头也没有工作)

代码的相关部分:

错误14:

#include "PlayerEntity.h"
PlayerEntity::PlayerEntity(void) {} // This line causes the error
Run Code Online (Sandbox Code Playgroud)

错误5:

class GameScreen : public BaseScreen
{
public:
    ...
private:
    ...
}; // This line causes the error
Run Code Online (Sandbox Code Playgroud)

错误4:

private:
     std::vector<BaseEntity*> _EntityList; // This line causes …
Run Code Online (Sandbox Code Playgroud)

c++ visual-studio-2012

19
推荐指数
1
解决办法
5万
查看次数

TypeScript 编译器忽略 tsconfig.json 中的声明文件

我目前正在尝试为打字稿 REST 使用者设置一个开发环境,并遇到以下问题:当将类型放入 .ts 源文件中时,编译器似乎会介意对类型的引用,但是当我尝试时完全忽略它们通过 tsconfig.json 中的单个 .d.ts 文件管理我的引用。

我花了一些error TS2307: Cannot find module 'request'.时间尝试编译以下代码:

import * as request from 'request';

module HTTPClient {
 ...   
}
Run Code Online (Sandbox Code Playgroud)

这是我的 tsconfig.json 文件:

{
  "compilerOptions": {
    "jsx": "react",
    "module": "commonjs",
    "noImplicitAny": true,
    "noEmitOnError": true,
    "outDir": "./build/",
    "preserveConstEnums": true,
    "removeComments": true,
    "target": "ES5",
    "declarationFiles": true,
    "moduleResolution": "classic"
  },

  "exclude": [
    "./node_modules",
    "./build",
    "./tests"
  ],

  "include": [
    "./src/ts/**/*",
    "./typings/main.d.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

这是我用来编译和捆绑所有内容的 gulp 代码:

var typescriptProject = typescriptCompiler.createProject(project['tsconfig'], { typescript: typescript });

gulp.task(
    'compile-ts', …
Run Code Online (Sandbox Code Playgroud)

javascript node.js browserify typescript gulp

5
推荐指数
1
解决办法
2672
查看次数