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

  • Home
  • SEARCH
  • 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 3244666
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:34:43+00:00 2026-05-17T18:34:43+00:00

I am not sure if I am doing the overload correctly. …\point.h(42) : error

  • 0

I am not sure if I am doing the overload correctly.

…\point.h(42) : error C2061: syntax error : identifier ‘Vec3’
Point operator +(Vec3 a) const;

Here is my .h file:

    #include <fstream>
    #include <iostream>
    #include "vec3.h"

    using std::ofstream;
    using std::ifstream;
    using std::cout;
    using std::cin;
    using std::endl;
    using namespace std;

    #ifndef POINT_H
    #define POINT_H

    //Define ourselves a basic 2D point class
    class Point
    {

        friend ofstream& operator <<(ofstream& output, const Point& p);
        friend ifstream& operator >>(ifstream& input, Point& p);
\    
        public:

        Point();
        Point(double _x, double _y);
        Point(double _x, double _y, double _z);

        double x,y,z;

        //Operators
        Point operator -(Point a) const;
        Point operator /(double s) const;
        Point operator *(double s) const;

        // Used to do vector point addition
        Point operator +(Vec3 a) const;

    };

    #endif

Here is my .cpp file

#include "point.h"

Point::Point(double _x, double _y, double _z)
{
    x= _x;
    y= _y;
    z= _z;
}

Point :: Point()
{
    x = 0.0;
    y = 0.0;
    z = 0.0;
}

Point::Point(double _x, double _y)
{
    x= _x;
    y= _y;
    z= 0;
}

    Point Point::operator -(Point a) const
    {
        return Point(x-a.x, y-a.y, z-a.z);
    }

    Point Point::operator /(double s) const
    {
        return Point(x/s, y/s, z/s);
    }

    Point Point::operator *(double s) const
    {
        return Point(x*s, y*s, z*s);
    }


// Vector Point Addition
    Point Point::operator +(Vec3 a) const
    {
        return Point(x+a.x, y+a.y, z+a.z);
    }

    ofstream& operator <<(ofstream& output, const Point& p)
    {
        output << p.x << " " << p.y << " " << p.z << "\n";
        return output;
    }

    ifstream& operator >>(ifstream& input, Point& p)
    {
        input >> p.x >> p.y >> p.z;
        return input;
    }

Here is the Vec3.h

    #ifndef VEC3_H
#define VEC3_H

#include "point.h"

class Vec3
{
    friend ofstream& operator <<(ofstream& output, const Vec3& p);
    friend ifstream& operator >>(ifstream& input, Vec3& p);

    public: 
    Vec3();
    Vec3(double _x, double _y);
    Vec3(double _x, double _y, double _z);

    double x,y,z;

    //Operators
    Vec3 operator -(Vec3 a) const;
    Vec3 operator /(double s) const;
    Vec3 operator *(double s) const;

    // Used to do vector Vec3 addition
    Vec3 operator +(Vec3 a) const;
    Point operator +(Point a) const;

};

#endif
  • 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-05-17T18:34:43+00:00Added an answer on May 17, 2026 at 6:34 pm

    vec3.h includes point.h and point.h includes vec3.h. You need to remove the circular dependency, by forward declaring one of the classes.

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

Sidebar

Related Questions

Okay, not sure what I'm doing here, other than it's not right. Trying to
Not sure what I'm doing wrong here, I just want to be able to
I'm not sure what I'm doing wrong here, I have a file in lib/acts_as_votable.rb
I'm not completely sure I understand the workflow way of doing things, but if
I'm sure I am just doing something really dumb and not seeing it but
Not sure if this is possible or if I'm expressing correctly what I'm looking
Not sure what exactly is going on here, but seems like in .NET 1.1
Not sure what's going on here. I have a DateTime object, and when I
Im not sure what im doing wrong. The file name is correct, the style
I seem to be getting application crashes at: parent.findViewById(R.id.a_1).setVisibility(View.VISIBLE); not sure what im doing

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.