compilation problem........code::blocks...

This is a discussion on compilation problem........code::blocks... within the C++ Programming forums, part of the General Programming Boards category; Hi.I have been trying to compile a program.But the following statements pop up in the message board when I try ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    13

    Unhappy compilation problem........code::blocks...

    Hi.I have been trying to compile a program.But the following statements pop up in the message board when I try to compile it........
    Code:
    C:\Program Files (x86)\CodeBlocks\now\main.cpp||In function 'int main()':|
    
    C:\Program Files (x86)\CodeBlocks\now\main.cpp|23|error: no match for 'operator>>' in 'std::cin >> w'|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|119|note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>& (*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|123|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|130|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|166|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|170|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|173|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|177|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|180|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|184|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|188|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|193|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|197|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|202|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|206|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|210|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|214|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\istream|238|note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]|
    
    C:\Program Files (x86)\CodeBlocks\now\main.cpp|24|error: 'clrscr' was not declared in this scope|
    ||=== Build finished: 2 errors, 0 warnings ===|
    I am new to code::blocks and the only compiler that I have used bfore is Turbo c++.......Please help I am really frustrated.....
    I will put the program too.......
    Code:
    #include <iostream>
    #include <istream>
    #include <stdlib.h>
    #include <stdio.h>
    #include <windows.h>
    #include <conio.h>
    #include <process.h>
    using namespace std;
    
    void gotoxy(int x, int y)
    {
      COORD coord;
      coord.X = x;
      coord.Y = y;
      SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
    }
    
    int main()
    {
        int x,i,j,c,w[6][7],q=0;
        char g[10];
        cout<<"Enter word";
        cin>>w;
        clrscr();
        for(i=0;i>7;i++)
        for(j=0;j>6;j++)
        w[i][j]=0;
        for(int a=0;g[a]!='\0';a++)
        {
            x=toupper(g[a]);
            c=c+4;
            switch(x)
            {
                case 65:for(i=2;i<6;i++)
                       {
                          w[i][1]=c;
                          w[i][4]=c;
                       }
                        for(j=2;j<4;j++)
                        {
                          w[1][j]=c;
                          w[3][j]=c;
                        }
                        break;
    
                case 66:for(i=1;i<6;i++)
                          w[i][1]=c;
                       for(i=2;i<5;i++)
                          w[i][4]=c;
                        for(j=2;j<4;j++)
                        {
                          w[1][j]=c;
                          w[5][j]=c;
                        }
                        for(j=2;j<5;j++)
                          w[3][j]=c;
                        break;
                case 67:for(i=1;i<6;i++)
                          w[i][1]=c;
                        for(j=1;j<5;j++)
                        {
                           w[5][j]=c;
                           w[1][j]=c;
                        }
                        break;
                case 68:for(i=1;i<6;i++)
                          w[i][1]=c;
                       for(i=2;i<5;i++)
                          w[i][4]=c;
                        for(j=2;j<4;j++)
                        {
                          w[1][j]=c;
                          w[5][j]=c;
                        }
                        break;
                case 69:for(i=1;i<6;i++)
                          w[i][1]=c;
                        for(j=1;j<5;j++)
                        {
                           w[5][j]=c;
                           w[1][j]=c;
                           w[3][j]=c;
                        }
                        break;
                case 70:for(i=1;i<6;i++)
                          w[i][1]=c;
                        for(j=1;j<5;j++)
                        {
                           w[1][j]=c;
                           w[3][j]=c;
                        }
                        break;
                case 71:for(i=1;i<6;i++)
                          w[i][1]=c;
                        for(j=1;j<5;j++)
                        {
                           w[5][j]=c;
                           w[1][j]=c;
                           w[3][j]=c;
                        }
                        w[4][4]=c;
                        break;
                case 72:for(i=1;i<6;i++)
                       {
                          w[i][1]=c;
                          w[i][4]=c;
                       }
                        for(j=2;j<4;j++)
                          w[3][j]=c;
                        break;
                case 73:for(i=2;i<6;i++)
                          w[i][3]=c;
                        for(j=2;j<5;j++)
                        {
                          w[1][j]=c;
                          w[5][j]=c;
                        }
                        break;
                case 74:for(i=2;i<6;i++)
                          w[i][3]=c;
                        for(j=1;j<5;j++)
                          w[1][j]=c;
                        w[5][1]=w[5][2]=c;
                        break;
                case 75:for(i=1;i<6;i++)
                          w[i][1]=c;
                        w[1][4]=w[2][3]=w[3][2]=w[4][3]=w[5][4]=c;
                        break;
                case 76:for(i=1;i<6;i++)
                          w[i][1]=c;
                        for(j=1;j<5;j++)
                           w[5][j]=c;
                        break;
                case 77:for(i=1;i<6;i++)
                       {
                          w[i][1]=c;
                          w[i][4]=c;
                       }
                        for(j=2;j<4;j++)
                          w[2][j]=c;
                        break;
                case 78:for(i=1;i<6;i++)
                       {
                          w[i][1]=c;
                          w[i][4]=c;
                       }
                       w[2][2]=w[3][3]=c;
                       break;
                case 79:for(i=1;i<6;i++)
                       {
                          w[i][1]=c;
                          w[i][4]=c;
                       }
                        for(j=2;j<4;j++)
                        {
                          w[1][j]=c;
                          w[5][j]=c;
                        }
                        break;
                case 80:for(i=1;i<6;i++)
                          w[i][1]=c;
                        for(j=1;j<5;j++)
                        {
                           w[1][j]=c;
                           w[3][j]=c;
                        }
                        w[2][4]=c;
                        break;
                case 81:for(i=1;i<6;i++)
                       {
                          w[i][1]=c;
                          w[i][3]=c;
                       }
                        for(j=2;j<4;j++)
                        {
                          w[1][j]=c;
                          w[5][j]=c;
                        }
                        w[5][4]=c;
                        break;
                case 82:for(i=1;i<6;i++)
                          w[i][1]=c;
                        for(j=1;j<5;j++)
                        {
                           w[1][j]=c;
                           w[3][j]=c;
                        }
                        w[2][4]=w[4][3]=w[5][4]=c;
                        break;
                case 83:for(j=1;j<5;j++)
                        {
                           w[5][j]=c;
                           w[1][j]=c;
                           w[3][j]=c;
                        }
                        w[2][1]=w[4][4]=c;
                        break;
                case 84:for(i=1;i<6;i++)
                          w[i][3]=c;
                        for(j=1;j<6;j++)
                           w[1][j]=c;
                        break;
                case 85:for(i=1;i<6;i++)
                       {
                          w[i][1]=c;
                          w[i][4]=c;
                       }
                        for(j=2;j<4;j++)
                          w[5][j]=c;
                        break;
                case 86:for(i=1;i<4;i++)
                       {
                          w[i][1]=c;
                          w[i][5]=c;
                       }
                       w[4][4]=w[5][3]=w[4][2]=c;
                       break;
                case 87:for(i=1;i<5;i++)
                       {
                          w[i][1]=c;
                          w[i][5]=c;
                       }
                       for(j=2;j<4;j++)
                          w[5][j]=c;
                       w[4][3]=w[3][3]=c;
                       break;
                case 88:w[1][1]=w[2][2]=w[3][3]=w[4][4]=w[5][5]=w[5][1]=w[4][2]=w[2][4]=w[1][5]=c;
                        break;
                case 89:for(i=3;i<6;i++)
                          w[i][3]=c;
                        w[1][1]=w[2][2]=w[2][4]=w[1][5]=c;
                        break;
                case 90:for(j=1;j<5;j++)
                        {
                           w[5][j]=c;
                           w[1][j]=c;
                        }
                        w[2][3]=w[3][2]=w[4][1]=c;
                        break;
                default:cout<<"Wrong Symbol";
                        getch();
                        exit(0);
            }
            for(int b=0;b<7;b++)
            {
                for(int c=0;c<6;c++)
                {
                    gotoxy(c,6*q);
                    cout<<w[b][c];
                }
            }
            q++;
        }
        cout<<"\n"<<c;
        cout<<"\n7x"<<q*6;
        return 0;
    }
    Thanks.....

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,266
    Have you even bothered to read your code? The first few lines of your main function are
    Code:
        int x,i,j,c,w[6][7],q=0;
        char g[10];
        cout<<"Enter word";
        cin>>w;
        clrscr();
    The second last of these is line 23, which (if you look at the second line of error messages) is where the compiler is getting upset.

    w is a two-dimensional array of int. With exceptions of C-style strings, no streaming operator is able to directly input or output any array type.

    The clrscr() line is line 24 (mentioned in the last line of error messages). The error message is telling you it cannot call a function named clrscr(). The reason is that no such function exists.
    Last edited by grumpy; 12-20-2010 at 01:59 AM.
    Right 98% of the time, and don't care about the other 3%.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    Code:
        int x,i,j,c,w[6][7],q=0;
        char g[10];
        cout<<"Enter word";
        cin>>w;
    cin doesn't know how to fill a 2D array of integers.

    > the only compiler that I have used bfore is Turbo c++
    If turbocrap can compile that line of code, then I'm afraid you've learnt a lot of rubbish.

    You have to make sure you're learning the language, then you can be reasonably sure that whatever you do will work on ANY compiler.
    Simply going with "well it seems to compile" will lead you to all sorts of problems when you change compiler.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,266
    Quote Originally Posted by Salem View Post
    > the only compiler that I have used bfore is Turbo c++
    If turbocrap can compile that line of code, then I'm afraid you've learnt a lot of rubbish.
    No version of Turbo C++ would have ever compiled that line of code.
    Right 98% of the time, and don't care about the other 3%.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  2. Compilation problem
    By OSDever in forum C++ Programming
    Replies: 10
    Last Post: 09-08-2005, 06:42 AM
  3. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  4. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21