Thread: How to Linux Program

  1. #16
    Registered User
    Join Date
    Jun 2008
    Posts
    266
    Ok it compiled good but the out file, which is new to me used to exe, won't even start.

  2. #17
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Try running it as
    Code:
    ./a.out

  3. #18
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Also, you can name the executable anything you want by using the -o option:
    Code:
    gcc -o myprog.exe myprog.c

  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    But it is highly uncustomary for Linux executables to have an extension.

    Code:
    gcc -o myprog myprog.c
    Of course, this can be done easier:
    Code:
    make myprog
    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

  5. #20
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You should also check out the GNU docs:
    www.delorie.com/gnu/docs/glibc/libc_toc.html
    GNU make glibc and gcc (which all linux systems and distros use). These are quite readable and informative. I think they also address some of your question re: how POSIX relates to "C", etc.
    Good luck.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #21
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Quote Originally Posted by CornedBee View Post
    But it is highly uncustomary for Linux executables to have an extension.
    True enough! Just thought it might shield him from the "horrors" of Linux

    Quote Originally Posted by CornedBee View Post
    Code:
    gcc -o myprog myprog.c
    Of course, this can be done easier:
    Code:
    make myprog
    You know, I've been developing various *nix flavors for 13 years, and I did not know that. And a Google shows that if I set the CFLAGS environment variable, I can default to use -g -Wall. Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can't compile an SDL program under Linux
    By dwks in forum Game Programming
    Replies: 2
    Last Post: 01-16-2006, 08:51 PM
  2. Compiling a C program in Linux
    By hern in forum C Programming
    Replies: 14
    Last Post: 06-28-2004, 08:33 PM
  3. A C++ program in Solaris that cannot be ported to Linux
    By tvenki in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2004, 12:13 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM