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 3308624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:32:37+00:00 2026-05-17T21:32:37+00:00

quaternion.h:15: error: field ‘v’ has incomplete type Hi! I am stuck on an error

  • 0

quaternion.h:15: error: field ‘v’ has incomplete type

Hi! I am stuck on an error that I cannot seem to solve.

Below is my code:

#ifndef QUATERNION_H
#define QUATERNION_H

#include "vec3.h"

class Vec3;

class Quaternion
{

public:

 Quaternion(Vec3 v);

 Quaternion(double w, Vec3 v);

 Vec3 v; <--------------------------This is where the error is :(

 double scalar;



 Quaternion operator *(Quaternion s);

 Quaternion conjugate();

};



#endif

My Vec.h looks like this:

#ifndef VEC3_H

#define VEC3_H



#include "point.h"

#include "quaternion.h"

#include <math.h>

class Quaternion;


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;

 Vec3 operator *(Quaternion q) const;



 // Used to do vector Vec3 addition

 Vec3 operator +(Vec3 a) const;

 Point operator +(Point a) const;



 Vec3& operator =(Point a);



 Vec3 crossProduct(Vec3 v1); // Itself cross v1

 double dotProduct(Vec3 v);

 double length();

 void normalize();


};



#endif

Thanks for the help again =)

  • 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-17T21:32:37+00:00Added an answer on May 17, 2026 at 9:32 pm

    Well, you have circular inclusion of two header files: vec3.h and quaternion.h. Include guards will make sure that each header is included only once. One of them will be included first, the other – second. In your case quaternion.h is included first, meaning that Vec3 becomes an incomplete type in it. This is what the compiler is telling you.

    Since you are trying to use Vec3 object as an immediate member of Quaternion object, you absolutely need Vec3 to be a complete type. The quaternion.h header must include vec3.h header. The

    class Vec3;
    

    declaration achieves absolutely nothing in quaternion.h, so you can just remove it.

    Given the above, it follows that vec3.h cannot include quaternion.h, or you’ll end up with circular inclusion, which never achieves anything. Remove the inclusion of quaternion.h from vec3.h. Keep the

    class Quaternion;
    

    declaration in vec3.h and see if it works that way.

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

Sidebar

Related Questions

I may be mistaken, but the basic explanation I've found has been that the
I have a simple IRenderable class that has members for position, scaling, and rotation:
it seems that there is a problem with my custom Quaternion implementation. Download My
I've got a pair of vectors. How can I create a quaternion that rotates
Any good libraries for quaternion calculations in C/C++ ? Side note: any good tutorials/examples?
So I have written a Quaternion based 3D Camera oriented toward new programmers so
I followed the question here Quaternion math for rotation? to get an angle of
Is there an existing algorithm for converting a quaternion representation of a rotation to
I am working on L-system interpreter and I use quaternion as internal representation of
I have a 3D camera with its current rotation stored as a quaternion, 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.