Thread: How to find out where the error or warning is in Microsoft Visual C++

  1. #1
    Registered User anoop29's Avatar
    Join Date
    Mar 2012
    Location
    Uk, London
    Posts
    4

    How to find out where the error or warning is in Microsoft Visual C++

    I'm so sorry for having to ask this question. I'm a beginner to C++, and as I'm following a tutorial, I tried to compile the cpp document. However doing so, I receive 1 error with 0 warnings.

    Here is what I have written...



    Code:
    /*
    An interactive program that computes
    the area od a rectangle.
    */
    #include <iostream>
    using namespace std;
    int main ()
    {
    int length;    // this declares a variable
    int width;    // this declares another variable 
    cout<<   "Enter the length:   ";
    cin>>   length;   //   input the length 
    cout<<   "Enter  the  width:   ";
    cin>>   width;   //   input   the  width
    cout<<   "the area  is   ";
    cout>>   length  *  width;   //   display   the   area
    return  0;
    }



    The error I get in the build window:





    --------------------Configuration: sample2 - Win32 Debug--------------------
    Compiling...
    sample3.cpp
    C:\Users\user\Documents\sample3.cpp(19) : error C2676: binary '>>' : 'class std::basic_ostream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acceptable to the predefined operator
    Error executing cl.exe.
    sample3.obj - 1 error(s), 0 warning(s)




    How do I know, or what do I look at to know where the error is.

    Like I said, I'm a beginner and would appreciate any help.

    Sorry if there has already been a thread on this before. I will try not to waste time and effort making a thread like this for the benefit of this website

    Any help would be appreciated!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > C:\Users\user\Documents\sample3.cpp(19)
    These are line numbers.
    a) turn on line numbers in the source code editor.
    b) there is a keyboard shortcut (and menu option) to take you to the next build error line.

    > cout>> length * width; // display the area
    You might want to compare the direction of >> with all your other cout statements.
    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.

  3. #3
    Registered User anoop29's Avatar
    Join Date
    Mar 2012
    Location
    Uk, London
    Posts
    4
    Quote Originally Posted by Salem View Post
    > C:\Users\user\Documents\sample3.cpp(19)
    These are line numbers.
    a) turn on line numbers in the source code editor.
    b) there is a keyboard shortcut (and menu option) to take you to the next build error line.

    > cout>> length * width; // display the area
    You might want to compare the direction of >> with all your other cout statements.

    Salem,

    Thanks ever soo much, I will try to do as you advised.

    Thanks again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Microsoft Visual C++ Express Edition Error?
    By DivingPhoenix in forum C++ Programming
    Replies: 3
    Last Post: 10-17-2007, 04:36 PM
  2. Cxx0030 error in microsoft visual c/c++
    By jamesT in forum C++ Programming
    Replies: 1
    Last Post: 06-13-2007, 01:48 PM
  3. Help me find this error and get rid of this warning message please
    By caduardo21 in forum Windows Programming
    Replies: 4
    Last Post: 02-18-2005, 09:21 PM
  4. Microsoft Warning
    By RPG'er in forum C++ Programming
    Replies: 3
    Last Post: 12-10-2002, 05:12 PM
  5. Replies: 1
    Last Post: 04-20-2002, 06:49 AM