C++ Visual Studio 2010未生成标题更新

C++ Visual Studio 2010未生成标题更新,c++,visual-studio-2010,header-files,C++,Visual Studio 2010,Header Files,我使用VisualStudio 2010用C++,尽管设置了预编译头选项,但不使用“预编译头”,它仍然坚持忽略我的头。在另一台机器上,它可以在相同的设置下正常工作。我怎样才能解决这个问题 复合物 #include <cmath> #include <cstdlib> using namespace std; class Complex{ private: double real, imaginary, magnitude, angle; double

我使用VisualStudio 2010用C++,尽管设置了预编译头选项,但不使用“预编译头”,它仍然坚持忽略我的头。在另一台机器上,它可以在相同的设置下正常工作。我怎样才能解决这个问题

复合物

#include <cmath>
#include <cstdlib>
using namespace std;

class Complex{

private:
    double real, imaginary, magnitude, angle;
    double rectangularToMagnitude(double, double);
    double rectangularToAngle(double, double);
    double polarToReal(double, double);
    double polarToImaginary(double, double);
public:
    Complex (char, double, double);
    Complex (double, double);
    Complex (double);
    Complex ();

    double getReal();
    double getImaginary();
    double getMagnitude();
    double getAngle();

    void setRectangular(double, double);
    void setPolar(double, double);
};
错误

error C2065: 'real' : undeclared identifier
error C2065: 'imaginary' : undeclared identifier
error C2065: 'magnitude' : undeclared identifier
error C2065: 'angle' : undeclared identifier
error C2065: 'real' : undeclared identifier
error C2065: 'imaginary' : undeclared identifier
error C2065: 'magnitude' : undeclared identifier
error C3861: 'rectangularToMagnitude': identifier not found
error C2065: 'angle' : undeclared identifier
error C3861: 'rectangularToAngle': identifier not found
error C2065: 'real' : undeclared identifier
error C3861: 'polarToReal': identifier not found
error C2065: 'imaginary' : undeclared identifier
error C3861: 'polarToImaginary': identifier not found
error C2065: 'magnitude' : undeclared identifier
error C2065: 'angle' : undeclared identifier
IntelliSense: identifier "real" is undefined
IntelliSense: identifier "imaginary" is undefined
IntelliSense: identifier "magnitude" is undefined
IntelliSense: identifier "angle" is undefined
IntelliSense: identifier "real" is undefined
IntelliSense: identifier "imaginary" is undefined
IntelliSense: identifier "magnitude" is undefined
IntelliSense: identifier "rectangularToMagnitude" is undefined
IntelliSense: identifier "angle" is undefined
IntelliSense: identifier "rectangularToAngle" is undefined
IntelliSense: identifier "real" is undefined
IntelliSense: identifier "polarToReal" is undefined
IntelliSense: identifier "imaginary" is undefined
IntelliSense: identifier "polarToImaginary" is undefined
IntelliSense: identifier "magnitude" is undefined
IntelliSense: identifier "angle" is undefined

例如,您需要在.cpp文件中将getReal()定义为Complex::getReal()。此外,getReal()之后的所有成员函数也是如此。

例如,您需要在.cpp文件中将getReal()定义为Complex::getReal()。此外,getReal()之后的所有成员函数都是这种情况。

请将您遇到的错误添加到您的问题中好吗?我有26个未声明的标识符错误,其中头文件中声明的变量未被识别。文件是第一次生成的(有学童错误),但更改文件后它不再生成。请确保将标题添加到正在生成的项目中。标题肯定是添加的,项目是第一次生成的,但当我去更正错误时,不再生成标头。当我在较旧版本的Visual Studio中遇到类似问题时,完整的重建有时会有所帮助。请将您遇到的错误添加到问题中,好吗?我有26个未声明的标识符错误,其中标头文件中声明的变量未被识别。文件是第一次生成的(有学童错误),但更改文件后它不再生成。请确保将标题添加到正在生成的项目中。标题肯定是添加的,项目是第一次生成的,但当我去更正错误时,标题不再生成。当我在旧版本的Visual Studio中遇到类似问题时,完整的重建有时会有所帮助。这很难发现。但是对于第一次看到代码的人来说可能更容易。这很难发现。但是对于第一次看到代码的人来说可能更容易。
error C2065: 'real' : undeclared identifier
error C2065: 'imaginary' : undeclared identifier
error C2065: 'magnitude' : undeclared identifier
error C2065: 'angle' : undeclared identifier
error C2065: 'real' : undeclared identifier
error C2065: 'imaginary' : undeclared identifier
error C2065: 'magnitude' : undeclared identifier
error C3861: 'rectangularToMagnitude': identifier not found
error C2065: 'angle' : undeclared identifier
error C3861: 'rectangularToAngle': identifier not found
error C2065: 'real' : undeclared identifier
error C3861: 'polarToReal': identifier not found
error C2065: 'imaginary' : undeclared identifier
error C3861: 'polarToImaginary': identifier not found
error C2065: 'magnitude' : undeclared identifier
error C2065: 'angle' : undeclared identifier
IntelliSense: identifier "real" is undefined
IntelliSense: identifier "imaginary" is undefined
IntelliSense: identifier "magnitude" is undefined
IntelliSense: identifier "angle" is undefined
IntelliSense: identifier "real" is undefined
IntelliSense: identifier "imaginary" is undefined
IntelliSense: identifier "magnitude" is undefined
IntelliSense: identifier "rectangularToMagnitude" is undefined
IntelliSense: identifier "angle" is undefined
IntelliSense: identifier "rectangularToAngle" is undefined
IntelliSense: identifier "real" is undefined
IntelliSense: identifier "polarToReal" is undefined
IntelliSense: identifier "imaginary" is undefined
IntelliSense: identifier "polarToImaginary" is undefined
IntelliSense: identifier "magnitude" is undefined
IntelliSense: identifier "angle" is undefined