Thread: C

  1. #1
    Join Date
    Jun 2003


    Wow. Thats a broad title. Anyways. I need help compiling and executing my c files through command prompt. What I did.

    vi new.c
    **inserted tons of code***
    gcc -c new.c
    **new.o appears**

    Now what do I do? I don't know how to link it into an executable. Someone told me something about make, and I don't know what to do. Can someone just tell me the other command to link it into an exec. file?
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

  2. #2
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    $ gcc -o new new.c
    $ ./new
    the first line produces the executable, the second executes it, -c tells gcc not to link the object file, so you won't get an executable in that case.

  3. #3
    Join Date
    Feb 2003
    however, "gcc -c" is what you would use if you have a multiple file project, then you would link them afterward.

Popular pages Recent additions subscribe to a feed