hello world doesnt start

This is a discussion on hello world doesnt start within the Linux Programming forums, part of the Platform Specific Boards category; oke this is my firs application for linux , an hellow orld as always Code: #include<stdio.h> int main() { printf("hello"); ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    70

    hello world doesnt start

    oke this is my firs application for linux , an hellow orld as always
    Code:
    #include<stdio.h>
    
    int main()
    {
                  printf("hello");
                 getchar();
                 return 0;
    }
    i dit it with the gcc command and as output i get a.out

    gcc hello.c


    but when i tried to run it(a.out) , it doesnt do anything

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    printf("hello\n");

    or

    printf("hello");fflush(stdout);
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    doenst make any different:s

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    So what does it say?
    a.out not found?

    Maybe try running it with
    ./a.out

    "It doesn't work" is not a meaningful report.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    it compilled and when i double click on it , it doesnt react

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    You type these commands in at a console prompt.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    YEAH , ./a.out did it , it said hello world in the terminal , but how do i let it do something in the GUI (mine is GNOME)

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    or do you just make things with the windows.h header?

  9. #9
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Quote Originally Posted by hallo007 View Post
    or do you just make things with the windows.h header?
    windows.h is a Windows operating system header. Unless someone happened to write a windows.h for Linux, that is not the way to do it.

  10. #10
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    *sigh* They're on their way there unfortunately, porting the registry & Win32 API to Linux...

    Anyway you need a 'GUI' library if you plan on greating a user interface, I would suggest GTK+

  11. #11
    Linux is where it's at movl0x1's Avatar
    Join Date
    May 2007
    Posts
    72
    When you compile with gcc it's better to name your output program something:

    something like 'gcc hello.c -o hello'

  12. #12
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Or simply
    $ make hello

    As for the WinAPI: WINE.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  13. #13
    Registered User
    Join Date
    May 2007
    Posts
    45
    wow make works so well, (= Why did no one it was easier that way. I had to go into the subdirectory to rename it before (= Thanks for the tip!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  2. WHEN to start game programming
    By mrcheesypants in forum Game Programming
    Replies: 18
    Last Post: 02-02-2006, 03:09 PM
  3. Need help from experts to start game programming
    By cader in forum Game Programming
    Replies: 8
    Last Post: 11-29-2005, 11:48 AM
  4. pthread_create start routine without args
    By discostu in forum C Programming
    Replies: 0
    Last Post: 04-09-2003, 11:01 PM
  5. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 11:01 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21