Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:24:24+00:00 2026-06-03T00:24:24+00:00

I am using Visual Studio 2010 with C++, and despite setting the precompiled headers

  • 0

I am using Visual Studio 2010 with C++, and despite setting the precompiled headers option to ‘not using precompiled headers’ it is still insisting on ignoring my header. On another machine it works fine with the same settings. How can I fix this?

Complex.h

#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);
};

Complex.cpp

#include "Complex.h"

// Three arguments passed, type and variables.
Complex::Complex(char type, double a, double b)
{
    switch(type)
    {
    case 'R':
    case 'r':
        setRectangular(a, b);
        break;
    case 'P':
    case 'p':
        setPolar(a, b);
        break;
    }
}

// Two arguments passed, assume rectangular.
Complex::Complex (double a, double b)
{
    real = a;
    imaginary = b;
    magnitude = rectangularToMagnitude(a, b);
    angle = rectangularToAngle(a, b);
}

// One argument passed, assume real, used to cast double to complex.
Complex::Complex (double a)
{
    real = a;
    imaginary = 0;
    magnitude = a;
    angle = 0;
}

// No argument passed, assume values of zero.
Complex::Complex ()
{
    real = 0;
    imaginary = 0;
    magnitude = 0;
    angle = 0;
}

// Convert real to imaginary and vice versa.
double Complex::rectangularToMagnitude(double re, double im) {return sqrt((re*re)+(im*im));}
double Complex::rectangularToAngle(double re, double im) {return atan2(im, re);}
double Complex::polarToReal(double ma, double an) {return ma*cos(an);}
double Complex::polarToImaginary(double ma, double an) {return ma*sin(an);}

// Accessors
double getReal() {return real;}
double getImaginary() {return imaginary;}
double getMagnitude() {return magnitude;}
double getAngle() {return angle;}

// Mutators
void setRectangular(double re, double im)
{
    real = re;
    imaginary = im;
    magnitude = rectangularToMagnitude(re, im);
    angle = rectangularToAngle(re, im);
}

void setPolar(double ma, double an)
{
    real = polarToReal(ma, an);
    imaginary = polarToImaginary(ma, an);
    magnitude = ma;
    angle = an;
}

Errors

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:24:26+00:00Added an answer on June 3, 2026 at 12:24 am

    You need to define, for instance, getReal() as Complex::getReal() in your .cpp file. Also, this is the case for all of your member functions after getReal().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Visual Studio 2010 RC1. I define a resource Brush2 in app.xaml_:
I'm using Visual Studio 2010 RC. Would it be possible that after doing my
I am using Visual Studio 2010 Ultimate Beta 2. What is the relevant namespace/classes
I'm using Visual Studio 2010 RTM with .NET/Entity Framework 4 RTM with a model
i am using visual studio 2010. i have a three dimensional structure array which,
I am using Visual Studio 2010. I've donwloaded an updated class (i.e. UpdatedClass.cs) which
We're using Visual Studio 2010 professional to develop and maintain our company ASP (classic
I have compiled this using Visual Studio 2010 compiler and it has compiler error
We are using Visual Studio 2010 and before each release to our test server
I'm using visual studio 2010 do developt my Windows phone application! I'm newbie and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.