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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:43:46+00:00 2026-06-17T10:43:46+00:00

When I compile this C program, I get an error: In function `main’: maxcount.cpp:(.text+0x63):

  • 0

When I compile this C program, I get an error:

In function `main': maxcount.cpp:(.text+0x63): undefined reference to `cnt(int)'

collect2: error: ld returned 1 exit status

What does it mean? Here is the code:

#include<iostream>
using namespace std;
int cnt(int);
int main()
{
  int x[30],i,j,q;
  cout<<"enter x[i]";
  for(i=0;i<7;i++)
  {
    cin>>x[i];
  }
  q = cnt(x[30]);
}
int cnt(int x[30])
{
  int i,j;
  int max=x[0];
  int count=0;
  for(i=0;i<7;i++)
  {
    if(x[i]>max)
    {
      max=x[i];
    }
    else
    {
      max=x[0];
    }
  }
  for(i=0;i<7;i++)
  {
    if(max==x[i])
    {
      count++;
    }
  }
  cout<<count;
  return 0;
}
  • 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-17T10:43:47+00:00Added an answer on June 17, 2026 at 10:43 am

    It means that it can not find a definition for int cnt(int);, which main() uses and you forward declare.

    Instead, you define:

    int cnt(int x[30]) { ... }
    

    These are two different signatures. One takes an integer argument, and the other takes an array of integers.

    Additionally, this statement is incorrect:

    q=cnt(x[30]);
    

    This takes the 31st element at index 30 from the x array. However, x is only declared to be of size 30. Since you are using x as an array inside your function, you probably just want to change your forward declaration to:

    int cnt(int[30]);
    

    And then invoke it like this:

    q = cnt(x);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to compile my program, I get the following error: main.cpp: In
I can't seem to get this program to compile. I keep getting the error:
when I'm trying to compile my c program it gives me this error warning:
If i compile the below program with std=c99, i get an error, but the
I am creating a program to copy a text file. I have a main.cpp
When I try and compile this program, I get errors (included below the code)
I'm trying to compile this simple program to start learning how to use timers:
I am trying to compile a one-off script, an autogenerated C# program. This program
When I attempt to compile the output of this trivial lex program: # lex.l
I tried to compile this example: #include <stdio.h> #include <stdlib.h> #include <stddef.h> main(){ size_t

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.