Thread: Alright this is wierd

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    11

    Alright this is wierd

    Im useing dev C++ and im currently trying to teach myself c++ with this websites help. I try useing the sample codes and i get multiple definition of 'main' errors...i copy and paste and ive typed it out...any help on this?

  2. #2
    Registered User
    Join Date
    Jan 2008
    Posts
    11
    nevermind

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Just make sure you never type "void main" please. Use "int main" if you see any sites using "void main". Just because the sites use it in their examples doesn't mean it's a good thing.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by Elysia View Post
    Just make sure you never type "void main" please. Use "int main" if you see any sites using "void main". Just because the sites use it in their examples doesn't mean it's a good thing.
    Is this some kind of standard reply that you just post if you don't have anything useful to say to a thread's topic ?
    Kurt

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No, but seeing as so many tutorials or stuff use void main, it can be good info.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Super unModrator
    Join Date
    Dec 2007
    Posts
    321
    ....i copy and paste...
    Many tutorials dont give the "complete" code,for example if they want to teach you loops,they will just write:
    Code:
    for(i=0;i<10;i++)
    {
              i+=1;
    }
    If you copy-paste these kind of things,obviously you will get errors.So include all the necessary header files,and paste the code in int main()

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Wierd **** - Order of Drawing Stuff?
    By Tonto in forum Game Programming
    Replies: 9
    Last Post: 11-09-2006, 09:56 PM
  2. Wierd chars...
    By mikahell in forum C++ Programming
    Replies: 8
    Last Post: 08-06-2006, 07:18 PM
  3. Wierd Text from File
    By hoangvo in forum C++ Programming
    Replies: 1
    Last Post: 07-30-2005, 12:05 AM
  4. This is wierd.
    By Ranedhel in forum C++ Programming
    Replies: 6
    Last Post: 12-12-2003, 03:26 PM
  5. Compiler Is Wierd
    By gnu-ehacks in forum C++ Programming
    Replies: 4
    Last Post: 12-06-2001, 04:43 AM