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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:31:17+00:00 2026-06-13T09:31:17+00:00

Possible Duplicate: Circular Dependencies / Incomplete Types writing a litte c++ program and be

  • 0

Possible Duplicate:
Circular Dependencies / Incomplete Types

writing a litte c++ program and be confused….

got 4 classes, 2 important for this error…

got the error message “field ‘dot’ has incomplete type” in Line 13 and “expected ‘;’ befor ‘(‘ token” in same Line

The Error seems to start in the Vector3.cpp, where only the include of the Vector3.h and the empty methodes

deleted the include “Vector3.h” in the Normal3 Header, thought will be running in a circle… not so well…

some ideas? hope so 🙂 and ty for answers

Here are my two important classes:

#ifndef NORMAL3_H
#define NORMAL3_H


class Normal3 {


      public:

      double x, y, z;
      Normal3 mul(Normal3 n);
      Normal3 add(Normal3 n);
      Normal3 dot(Vector3 v); //Line 13

      Normal3(double x = 0, double y = 0, double z = 0)
                     : x(x), y(y), z(z)
      { }   

};

#endif //NORMAL3_H

AAAAAAAAAAAAAAAAAAAAAND

#ifndef VECTOR3_H
#define VECTOR3_H

#include "Normal3.h"

class Vector3 {

      public:

      double x, y, z, magnitude;

      Vector3 add(Vector3 v);
      Vector3 add(Normal3 n);
      Vector3 sub(Normal3 n);
      Vector3 mul(double c);
      double dot(Vector3 c);
      double dot(Normal3 n);
      Vector3 normalized();
      Normal3 asNormal();
      Vector3 refelctedOn(Normal3 n);

      Vector3(double x = 0, double y = 0, double z = 0, double m = 0)
                     : x(x), y(y), z(z), magnitude(m)
      { }

};

#endif //VECTOR3_H
  • 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-13T09:31:18+00:00Added an answer on June 13, 2026 at 9:31 am

    It just means that the compiler does not know what Vector3 is at that point. If you declare it in advance, the error will disappear:

    #ifndef NORMAL3_H
    #define NORMAL3_H
    
    class Vector3;  // Add this line
    
    class Normal3 {
      // ...
    };
    

    UPDATE: As john says in his comment, it would be a good improvement to replace #include "Normal3.h" in Vector3.h with just another forward declaration, class Normal3;:

    #ifndef VECTOR3_H
    #define VECTOR3_H
    
    class Normal3; // instead of #include "Normal3.h"
    
    class Vector3 {
      // ...
    };
    

    You should try to keep #include directives in your headers to a minimum in order to avoid excessive compilation dependencies. You only need to include a header if it defines a type you are using (usually because a class you are defining has a data member of this type). If you are only using pointers or references to that type or function parameters of that type (as in your example), a forward declaration is enough.

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

Sidebar

Related Questions

Possible Duplicate: Circular Dependency with forward declaration error I have two files, one that
Possible Duplicate: Resolve build errors due to circular dependency amongst classes I am pretty
Possible Duplicate: Avoiding Circular Dependencies of header files Task.h: #ifndef Tasks_h #define Tasks_h #include
Possible Duplicate: ViewPager as a circular queue / wrapping I have three fragment classes
Possible Duplicate: Circular (or cyclic) imports in Python I have class B that imports
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Circular definition in C typedef struct{ node *next; node *last; } doubleLink;
Possible Duplicate: What are the stages of compilation of a C++ program? I find
Possible Duplicate: Filetype association with application (C#) I'm writing a C# Windows app to

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.