Find the answer to your Linux question:
Results 1 to 3 of 3
hey guys i have a question. when i write this lines of code : Code: #include <iostream.h> int main&#40;&#41; &#123; int x; x=10; cout<<x<<endl; return 0; &#125; and later compile ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2003
    Posts
    41

    problems compiling C++ code using rhide


    hey guys i have a question. when i write this lines of code :
    Code:
    #include <iostream.h>
    
    int main&#40;&#41;
    &#123;
    	int x;
    	x=10;
    	cout<<x<<endl;
    	return 0;
    &#125;
    and later compile it using rhide i get an error message saying that i have an error in #include <iostream.h> line but i don't know what is wrong there. can you help me?

  2. #2
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    Location
    England
    Posts
    1,219
    This will work C++ does not need the .h like C.
    Code:
    #include <iostream>
    
    int main&#40;&#41;
    &#123;
       int x;
       x=10;
       cout<<x<<endl;
       return 0;
    &#125;
    and if you are not using
    Code:
    using namespace std;
    you need to use
    Code:
    STD&#58;&#58;cout << x << STD&#58;&#58;endl;

  3. #3
    Just Joined!
    Join Date
    Dec 2003
    Posts
    41
    hoo really tell that to my C++ book. anyway, thank you very much now i understand what the problem was

  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
  •