Thread: Dev-C++ Hello World help!!

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    2

    Dev-C++ Hello World help!!

    i was trying to do a simple Hello world in C in Dev-C++ but it keeps on get a error.

    here's is the code i used

    Code:
    #include <stdio.h>
    
    int main(void)
    {
        printf("Hello World");
        getch();                           
        }
    then when i try to compile ans run these errors come up

    Line File Message
    C:\Dev-Cpp\Untitled1.c In function `int main()':
    6 C:\Dev-Cpp\Untitled1.c `getch' undeclared (first use this function)
    (Each undeclared identifier is reported only once for each function it appears in.)
    C:\Dev-Cpp\Makefile.win [Build Error] [Untitled1.o] Error 1

  2. #2
    Registered User Inanna's Avatar
    Join Date
    May 2011
    Posts
    69
    getch() is declared in conio.h, but you did not include it.
    Code:
    #include <stdio.h>
    #include <conio.h>
    
    int main()
    {
        printf("Hello World\n");
        getch();
    }

  3. #3
    Registered User
    Join Date
    May 2011
    Posts
    2
    thanks for you reply but it still says the same errors

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Don't use a crappy, no longer supported IDE like Dev-C++. There are lots of other options, including Code::Blocks, Visual C++ Express, PellesC, and the successor to Dev-C++, wxDev-C++.

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    At the very least, it never hurts to pick a function that exists, like getchar().

  6. #6
    Registered User shubham's Avatar
    Join Date
    May 2011
    Posts
    14
    remove the void between the paretheses

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by shubham View Post
    remove the void between the paretheses
    If you're referring to main... the correct form is.... int main (void)
    And that won't make any difference if you try to call a function that doesn't exist in the library of the compiler you're using.

    Code:
    #include <stdio.h>
    
    int main( void )
    {
        printf("Hello World\n");
        getchar();
    
        return 0; 
    }
    Last edited by CommonTater; 05-29-2011 at 02:46 PM.

  8. #8
    Registered User Inanna's Avatar
    Join Date
    May 2011
    Posts
    69
    thanks for you reply but it still says the same errors
    Dev-C++ FAQ

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hello World V 03 02 02
    By SRS in forum C++ Programming
    Replies: 15
    Last Post: 11-07-2007, 12:58 PM
  2. Hello World 180 KB???????
    By Musicdip in forum C++ Programming
    Replies: 17
    Last Post: 06-22-2002, 07:27 PM
  3. New to the World
    By oo0speed0oo in forum Game Programming
    Replies: 12
    Last Post: 04-04-2002, 10:46 AM
  4. Hello, World.
    By gmichael2000 in forum C++ Programming
    Replies: 4
    Last Post: 02-26-2002, 02:14 PM
  5. Hello World in C#
    By Witch_King in forum A Brief History of Cprogramming.com
    Replies: 51
    Last Post: 08-24-2001, 02:09 PM

Tags for this Thread