Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > Compiling program in C to run in Terminal

Compiling program in C to run in Terminal
Thread Tools
surfacto
Dedicated MacNNer
Join Date: Oct 2001
Location: California
Status: Offline
Reply With Quote
Jul 16, 2003, 04:22 PM
 
Disclaimer: I am not a programmer. I am a Mac user.

I am running LabVIEW for Mac and Windows and in Windows it calls the Dos prompt and runs a program written in C. I'm thinking I could do this on the Mac in Terminal, but I would need to compile the program in the right language and get it to run. Any ideas how to get started on this? What language to compile? Software that may help me compile it? Thanks.
     
alien
Mac Enthusiast
Join Date: Jan 2002
Location: Trondhjem, Norway
Status: Offline
Reply With Quote
Jul 16, 2003, 04:31 PM
 
This is really a question for the developer forum, but a short answer would be to install the Developer Tools package that comes with OS X. (Or register as an ADC member at apple and download it from there. It's free.)

Then you'll have gcc, the standard compiler, which can compile C programs (and other languages too).

From the command line it would look something like:
% cc -o myprogram myprogram.c

Then you'll have an executable called myprogram that can run in Terminal.
     
jessejlt
Mac Enthusiast
Join Date: Feb 2003
Location: Portland, Oregon
Status: Offline
Reply With Quote
Jul 16, 2003, 05:18 PM
 
gcc file.c
mv a.out myapp.command

When a .command file is double clicked, it opens a new terminal window and executes the files.
jesse ;-)
     
Uncle Skeleton
Addicted to MacNN
Join Date: Nov 2002
Location: Rockville, MD
Status: Offline
Reply With Quote
Jul 16, 2003, 06:40 PM
 
do you have the source code (a .c file) for this program? it won't work if you just have the excutable program
     
surfacto  (op)
Dedicated MacNNer
Join Date: Oct 2001
Location: California
Status: Offline
Reply With Quote
Jul 17, 2003, 11:01 AM
 
Thanks for your help!
I do have the source code, or actually the guy who wrote it is sending it to me from Germany. Hope it works, this would make my life much easier!
     
absmiths
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Jul 17, 2003, 03:13 PM
 
Originally posted by surfacto:
Thanks for your help!
I do have the source code, or actually the guy who wrote it is sending it to me from Germany. Hope it works, this would make my life much easier!
Unless this app is trivial, or just uses plain vanilla std library stuff, I wouldn't expect this to be too easy for someone who doesn't write software at all.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 07:15 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,