Find the answer to your Linux question:
Results 1 to 3 of 3
I tried to run the following programme using g++ in linux mint and got a wonderful error....... a little help please //programme to find transpose of a matrix #include<iostream> int ...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    2

    Exclamation c ++ error

    I tried to run the following programme using g++ in linux mint and got a wonderful error.......
    a little help please


    //programme to find transpose of a matrix
    #include<iostream>
    int main()
    {
    using namespace std;
    int a[10][10],b[10][10],i,j,m,n;
    cout <<"Enter the number of rows and columns of the matrix -"<<endl;
    cin>>m>>n;
    cout<<"Input the values of the matrix ="<<endl;
    for(i=0;i<m;i++)
    {
    for (j=0;j<n;j++)
    cin>>a[i][j];
    }
    cout<<"the matrix enterd is :"<<endl;
    for (i=0;i<m;i++)
    {
    cout <<"\n";
    for (j=0;j<n;j++)
    cout <<" "<<a[i][j];
    }
    cout <<"The transpose of the matrix u have enterd is -";
    for (i=0;i<m;i++)
    {
    cout<<"\n";
    for (j=0;j<n;j++)
    b[i][j]=a[i][j];
    cout<<b[i][j]<<" ";
    }
    return 0;
    }

    error:-
    /usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o: In function `_start':
    /build/buildd/eglibc-2.10.1/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
    collect2: ld returned 1 exit status

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Could you post your makefile or compile line...
    Make mine Arch Linux

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    The problem is here:
    Code:
    int main()
    {
    .
    .
    .
    }
    The signature for main() is defined as either
    Code:
    int main(void)
    or
    Code:
    int main(int, const char**)
    The second argument can be either as shown, or can be char**, or const char*[], or char*[] as well, depending upon how mutable you want your argument list and its contents to be. In any case, it has to be some sort of arrays of pointers to char strings, or a void argument list altogether.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...