Find the answer to your Linux question:
Results 1 to 3 of 3
Ok so this is the code i wrote below Code: #include <iostream> using namespace std; int main() { int thisisanumber; cout<<"Please enter a number: "; cin>> thisisanumber; cin.ignore(); cout<<"You entered: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    May 2009
    Location
    Kitchener, Ontario, Canada
    Posts
    206

    [SOLVED] C++ with codeblocks in Windows 7


    Ok so this is the code i wrote below

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
      int thisisanumber;
    
      cout<<"Please enter a number: ";
      cin>> thisisanumber;
      cin.ignore();
      cout<<"You entered: "<< thisisanumber <<"\n";
      cin.get();
    }

    it errors out by saying "error: iostream: No such file or directory

    in function 'main':
    error 'cout' undeclared

    any ideas?

  2. #2
    Just Joined!
    Join Date
    Dec 2009
    Location
    Maryland, USA
    Posts
    82
    I'm curious why you're asking Windows 7 programming questions in a Linux forum. There are C++ programming forums for Windows that might be better suited to answer your questions.

    It appears that you don't have the C++ compiler/development environment installed or set up correctly on your Windows machine. The C++ compiler you've installed should be able to find the C++ libraries it needs, like iostream, to compile your programs. Review the requirements for your environment and the install you performed (or didn't perform) and fix whatever's wrong.

  3. #3
    Linux Newbie
    Join Date
    May 2009
    Location
    Kitchener, Ontario, Canada
    Posts
    206
    i actualy figured it out it. i saved it as a C file instead of a cbp file if that makes sense

  4. $spacer_open
    $spacer_close

Posting Permissions

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