Thread: Noobified help lol

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    Question Noobified help lol

    I have never programed anything befor, im using bloodshed 5 beta compiler too try and go threw this sites tutorials. But even in the most simple code i get 3 error's haha this is the code;

    #include <iostream.h>

    main()

    {

    cout<<"The Compiler Work">;

    return 0;

    }

    When i compile these are the messages i get lol.
    iostream.h:no such file or directory
    Warning in function `int main()':
    `cout' undeclared (first use this function)
    [build error](Each undeclared identifier is repotred only once for each function it appears in.)
    Execution terminated.

    Sorry for the super noob post and thanks for any answers anyone can give.

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Code:
    #include <iostream>
    
    int main()
    {
        std::cout<<"The Compiler Work";
        return 0;
    }
    iostream.h is no longer standard.
    cout is now in the std namespace.
    Specify a return type for main.
    You had a greater than sign after your quotes.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    103

    An added information

    Originally posted by Polymorphic OOP
    [code]#include <iostream>

    Specify a return type for main.
    With respect to the returning the value from main, the standard says that if you don't return any value from main, it will default to a return value of zero.

    Pun: wonder howmany compiler are sticking to the standards
    Have a wonderful day.... and keep smiling... you look terrific that way
    signing off...
    shiv... as i know him

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    you should still return the type of int for main. (good practice)

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Originally posted by alpha
    you should still return the type of int for main. (good practice)
    In Win32 you'lle be forced to return something or windows
    will kick you in the nutts!
    I suggest you just DO it.

  6. #6
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078

    Re: An added information

    Originally posted by shiv_tech_quest
    With respect to the returning the value from main, the standard says that if you don't return any value from main, it will default to a return value of zero.

    Pun: wonder howmany compiler are sticking to the standards
    I didn't disagree with that! That is true, the default return value from main is 0

    However you still must specify what the return type is or else it is not valid C++!!!

    main() with no return type is not valid

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. lol need some help :D
    By lolol in forum C Programming
    Replies: 28
    Last Post: 03-28-2008, 07:46 AM
  2. The Recruit - LOL using C
    By Xei in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 04-25-2003, 05:47 AM
  3. Visual C++ 6.0 Debugs my computer lol
    By RoD in forum Tech Board
    Replies: 9
    Last Post: 03-30-2003, 05:13 PM
  4. lol, funniest acting program EVER -- and i need help with it :(
    By Leeman_s in forum Windows Programming
    Replies: 1
    Last Post: 01-09-2003, 07:27 PM
  5. Lol!
    By no-one in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 02-11-2002, 12:29 PM