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

The Archive Base Latest Questions

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

With the 4.2.1 g++ compiler I get the following error: functions.cpp:24: error: call of

  • 0

With the 4.2.1 g++ compiler I get the following error:

functions.cpp:24: error: call of overloaded ‘pow(long int&, long int&)’ is ambiguous
/usr/include/architecture/i386/math.h:343: note: candidates are: double pow(double, double)
/usr/include/c++/4.2.1/cmath:373: note:                 long double std::pow(long double, int)
/usr/include/c++/4.2.1/cmath:369: note:                 float std::pow(float, int)
/usr/include/c++/4.2.1/cmath:365: note:                 double std::pow(double, int)
/usr/include/c++/4.2.1/cmath:361: note:                 long double std::pow(long double, long double)
/usr/include/c++/4.2.1/cmath:357: note:                 float std::pow(float, float)

Here’s the responsible code:

long power(long a, long b) {
    if (b < 0) return 0;
    return pow(a,b);
}

However, on my 4.6.1 version there are no errors nor warnings for my code where I use two longs for the pow evaluation (even with the -Wextra flag).
Why is this? And is using two longs for the pow function a mistake on my part?

  • 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-30T00:31:44+00:00Added an answer on May 30, 2026 at 12:31 am

    The problem is that there is no definition of pow that takes two longs as parameters. Because of this, the longs will be converted into some other data type, but this conversion causes ambiguity since there are many possible ways that the conversion can happen. gcc doesn’t know how to interpret the call, so it gives you an error.

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

Sidebar

Related Questions

I wanted to use boost::thread in my program, but get the following compiler error
When I compile my application , I get following compile error. Unable to find
I get the following error when I try to compile an asp.net site using
I get the following error: One or more types required to compile a dynamic
When attempting to compile my C# project, I get the following error: 'C:\Documents and
When I try to compile Gforth 0.7.0, I get the following error: $ ./configure
For the attached code, I get the following compile time error : exception during
In the following code, I get a compile time error: ByRef Argument type mismatch.
In the following code, I get a compile time error because i is treated
With the Visual Studio 2005 C++ compiler , I get the following warning when

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.