Thread: Building Files

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    32

    Building Files

    Hopefully this is a simple problem...I've done alot of programming assignments in my short stint as a CS minor. Made alot of seemingly useless programs. So recently I decided to make something of use. I have a simple program that returns the total amount of money for any number of coins. Heres my question, is there any way to build that program into a *.exe or *.app file so it could be used whenever?

    Seems like the next logical step in making these programs...correct me if I'm wrong.

    Thank you for your time in advance,
    Michael

  2. #2
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Yeah, technically, your compiler does this for you.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    32
    very good sir...i apologize for not being clear.

    The only potentially executable file is *.out which cannot be opened by double clicking on it.

    Sure I can run it in Terminal but curiousity was killing my cat as to whether or not there was some way to make a program I can say, leave in my Dock.

    -Michael

  4. #4
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    So you're using gcc ?

    Try compiling doing :

    gcc source.c -o file

    file will then be an executable. Which you can then execute by going to the directory in which you outputed to and typing :

    ./file
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    32
    gcc Assignment1.c -o Assignment1.app

    doesn't work so i suppose running the *.out file in terminal will have to do...oh well

    thanks for your time

  6. #6
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    no my bad,

    try gcc -o file source.c

    Afterwards check in your folders if you have a file called file. This file should be an executable. Do you see it ?
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  7. #7
    The C eater *munch*
    Join Date
    Oct 2006
    Posts
    101
    Quote Originally Posted by iiwhitexb0iii
    Hopefully this is a simple problem...I've done alot of programming assignments in my short stint as a CS minor. Made alot of seemingly useless programs. So recently I decided to make something of use. I have a simple program that returns the total amount of money for any number of coins. Heres my question, is there any way to build that program into a *.exe or *.app file so it could be used whenever?

    Seems like the next logical step in making these programs...correct me if I'm wrong.

    Thank you for your time in advance,
    Michael
    did you mean portability? (ie. can be used in windows, *nix etc)

  8. #8
    Registered User
    Join Date
    Feb 2006
    Posts
    32
    the *.out file has to be ran in terminal and the *.nix file doesn't run properly in terminal, cannot be executed otherwise...

    -michael

  9. #9
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    You also have to run the executable from the terminal. Gcc defaults as making *.out the executable. To run your executable, go to the directory it is located and type : ./prog
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  2. building source files?
    By Calef13 in forum C++ Programming
    Replies: 1
    Last Post: 03-27-2006, 11:24 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  4. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  5. header and source files
    By gtriarhos in forum C Programming
    Replies: 3
    Last Post: 10-02-2005, 03:16 AM