C++ error / dev-C++ compile error

Discussion in 'Programming' started by Voimis, Oct 17, 2007.

  1. #1
    Hi guys!

    I just installed dev-C++ to my computer and I created new source file.

    I wrote to source file:

    #include <iostream.h>
    
    void main()
    {
      cout << "Hello world!";
    }
    PHP:
    Then I pressed execute => compile but it doesn´t work at all.
    It gives just this screend and doesn´t compile the file.

    http://img120.imageshack.us/img120/6341/screenhunter01oct172031jx2.gif

    Help!

    Thanks!
     
    Voimis, Oct 17, 2007 IP
  2. firesexwater

    firesexwater Peon

    Messages:
    19
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    instead of iostream.h put iostream
    basically delete the .h and try let me know what happens
     
    firesexwater, Oct 17, 2007 IP
  3. Voimis

    Voimis Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I got it working! I just deleted the .h-tag. Thanks!
     
    Voimis, Oct 18, 2007 IP
  4. MetaCipher

    MetaCipher Peon

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    iostream.h is old, don't use it. Instead, using <iostream> and use std::cout. Also, your main function is in a bad format; you can obviously tell how old Dev-C++ is. I recommend you use a different IDE, like CodeBlocks (which is free; Google it).
     
    MetaCipher, Oct 22, 2007 IP
  5. neelesh

    neelesh Peon

    Messages:
    141
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You could have used "using namespace std;"
     
    neelesh, Oct 23, 2007 IP
  6. mhaye_01

    mhaye_01 Banned

    Messages:
    395
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    cout<<

    no space..
     
    mhaye_01, Oct 25, 2007 IP
  7. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #7
    use
    
    cout << "Hello world!" << endl;
    
    Code (markup):
     
    it career, Oct 25, 2007 IP
  8. MetaCipher

    MetaCipher Peon

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Why are people still posting in this thread? <iostream>, std::cout << "Hi"; blah blah. And please, like I said, don't use Dev-C++.
     
    MetaCipher, Oct 25, 2007 IP