Visual Studio 2010 Expressを使用していますが、ファイルtest.hで次のエラーが発生します。これは、コンパイルされた出力の場合です。
test.h(4): error C2061: syntax error : identifier 'test'
test.h(4): error C2059: syntax error : ';'
test.h(4): error C2449: found '{' at file scope (missing function header?)
test.h(18): error C2059: syntax error : '}'
test.hファイルは次のように記述されています。
#ifndef TEST_H
#define TEST_H
class test {
int a;
int b;
public:
test(int a, int b) {
this->a = a;
this->b = b;
}
int add() {
return 0;
}
};
#endif
VS2010プロジェクトの他のファイルはtest.cで、これは次のとおりです。
#include "test.h"
int main(int argc, char** argv) {
return 0;
}
私はこの問題を解決するために多くの方法を試しました。test.hを次のように定義しても:
class test{
};
それでも同じエラーが発生します。
同様の問題 https://stackoverflow.com/questions/7798876/strange-errors-when-using-byte-pbyte-instead-of-char-char-in-vs2k10-wdk-envi が応答なしで表示されました。
誰かがこれらのエラーを解決する方法を指摘していただければ本当にありがたいです。
ありがとう、