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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:43:37+00:00 2026-05-28T00:43:37+00:00

I have the following header functions: float computeDistance3(Vector3f& vec_a, Vector3f& vec_b); float computeDotProduct3(Vector3f& vecta,

  • 0

I have the following header functions:

float computeDistance3(Vector3f& vec_a, Vector3f& vec_b);

float computeDotProduct3(Vector3f& vecta, Vector3f& vectb);

float computeGeoDotProd3(Vector3f& vecta, Vector3f& vectb);

With the following definitions

float computeDistance3(Vector3f& vec_a, Vector3f& vec_b) {
    float x = vec_a.x - vec_b.x;
    float y = vec_a.y - vec_b.y;
    float z = vec_a.z - vec_b.z;

    return sqrt((x * x) + (y * y) + (z * z));
}

float computeDotProduct3(Vector3f& vec_a, Vector3f vec_b) {
    return (vec_a.x * vec_b.x) 
         + (vec_a.y * vec_b.y) 
         + (vec_a.z * vec_b.z);
}

float computeGeoDotProd3(Vector3f& vecta, Vector3f& vectb) {
    float amag, bmag, dotProd;

    amag = vecta.computeMagnitude();
    bmag = vectb.computeMagnitude();

    dotProd = computeDotProduct3(vecta, vectb);

    bool notZero = (amag != 0.0f && bmag != 0.0f) && dotProd != 0.0f;

    if (notZero) {
        return cosf(dotProd / (amag * bmag));
    } else {
        return -1.0f;   
    }

}

I know that their signatures are the same. Is this confusing the compiler? I’m guessing so, because when I compile the code, I get this:

vector3f.cpp: In function ‘float computeGeoDotProd(Vector3f&, Vector3f&)’:                                                                                                  
vector3f.cpp:139:43: error: call of overloaded ‘computeDotProduct3(Vector3f&, Vector3f&)’ is ambiguous                                                                      
vector3f.cpp:139:43: note: candidates are:                                                                                                                                  
vector3f.h:31:7: note: float computeDotProduct3(Vector3f&, Vector3f&)                                                                                                       
vector3f.cpp:127:7: note: float computeDotProduct3(Vector3f&, Vector3f)   

Question

What is the solution to unconfusing the compiler?

  • 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-28T00:43:38+00:00Added an answer on May 28, 2026 at 12:43 am

    You’re missing an & in the definition:

    float computeDotProduct3(Vector3f& vec_a, Vector3f vec_b) {
    

    should be:

    float computeDotProduct3(Vector3f& vec_a, Vector3f& vec_b) {
    

    So you end up with two different (overloaded) function prototypes that differ only by the reference & – hence ambiguous.

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

Sidebar

Related Questions

I have the following html code: <h3 id=headerid><span onclick=expandCollapse('headerid')>&uArr;</span>Header title</h3> I would like to
When you have inline definitions of functions in the header file, and you want
I have a stored procedure with the following header: FUNCTION SaveShipment (p_user_id IN INTEGER,
In my masterpage, I have the following in the header. This allows me to
Let's say I have the following HTML: <table id=foo> <th class=sortasc>Header</th> </table> <table id=bar>
All, i have the following model defined, class header(models.Model): title = models.CharField(max_length = 255)
I have C header file containing the following type definition: // example.h typedef struct
I have a header.html which start with session_start();. Then the following code, $_SESSION['cart'][$sw_id] is
I have created UITableCellView class called NoteCell . The header defines the following: #import
I have the following chunk of a header file BKE_mesh.h: /* Connectivity data */

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.