Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Turbo c compiler for mac

  • 09-02-2009 11:51am
    #1
    Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭


    hey,
    i'm in ucd doing first year engineering, i have computer science as a practical but dont want to sit in the computer lab for 2 hours each week. does any1 know how to get a compiler for my mbp? any help would be greatly appreciated and bear in my mind i'm not particularly computer savvy
    thanks


Comments

  • Registered Users, Registered Users 2 Posts: 3,568 ✭✭✭ethernet


    gcc should already be installed.

    You can compile using something like this (where nextBigThing.c is in the current directory):
    gcc nextBigThing.c -o nextBigThing
    

    and then execute it using:
    ./nextBigThing
    

    For your sanity, you may prefer using an IDE. Xcode -- on the Leopard DVD -- supports C, as does Eclipse (open source IDE).

    Edit: don't forget fflush() is fpurge() on Unix-like systems!


  • Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭abcdggs


    Thanks for the reply but due to my lack of experience most of what you have said makes no sense to me. could you please explain this as simply as possible.
    thanks a million


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    write your C program using a text editor of your choice (i use smultron).

    save it in a directory.

    hit cmd + space to open spotlight.

    type in terminal press enter.

    type the following in the terminal.

    cd /path/to/my/c/program

    where /path/to/my/c/program is the location of where you saved your c program. press enter.

    then type this

    gcc -Wall -o myCprogam myCprogram.c

    where myCprogram is the name of the executeable you want to make and myCprogram.c is the name of the c program you wrote.

    ohh and i suggest you go to labs so you can learn this stuff. it's what you're going to college for.


  • Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭abcdggs


    i did all the above, but i get a message saying not a directory?? any ideas how to solve this??


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    at what part are you getting that error message.

    type what command you are entering in, i'm assuming it's a cd command as cd usually returns that message when you try to change directory an point it towards a file.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭abcdggs


    i just copied from terminal
    "
    Last login: Wed Feb 11 13:50:12 on ttys000
    dhcp-892bf9a0:~ john$ cd /Users/john/Desktop/abc.c
    -bash: cd: /Users/john/Desktop/abc.c: Not a directory
    dhcp-892bf9a0:~ john$
    "


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    abcdggs wrote: »
    i just copied from terminal
    "
    Last login: Wed Feb 11 13:50:12 on ttys000
    dhcp-892bf9a0:~ john$ cd /Users/john/Desktop/abc.c
    -bash: cd: /Users/john/Desktop/abc.c: Not a directory
    dhcp-892bf9a0:~ john$
    "


    dhcp-892bf9a0:~ john$ cd /Users/john/Desktop/abc.c

    you cannot cd into a file.

    you'll need to do this.

    cd /Users/john/Desktop/

    gcc -Wall -o abc abc.c

    if all goes well (if no errors are found in your C program) a file called abc will be created and you can run it by typing the following.

    ./abc


  • Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭abcdggs


    i changed the directory the typed
    gcc -wall -o abc abc.c

    but then it tells me command not found


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    type at the terminal

    which gcc

    does it return something like this.

    /usr/bin/gcc

    i'm on linux at the moment which may have slight differences but if it comes back with nothing or command not found, you'll need to get gcc installed.

    try

    cc -Wall -o abc abc.c

    i don't know if cc is installed on mac but it's worth a shot.

    if not get your OS X cd/dvd pop it in and install XCode Tools.


  • Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭abcdggs


    great, will have to get that disc at home

    thanks


  • Advertisement
  • Closed Accounts Posts: 3,152 ✭✭✭ozt9vdujny3srf


    Without wanting to sound smart, If you arent that computer savvy, then you might need the demonstrators help with your assignments.

    Engineering is not something you can breeze through spending as little time in college as possible...


  • Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭abcdggs


    i intend to prove you wrong:)


  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    it happens, people waltz through college doing as little as possible and everything is fine and dandy.

    but when it comes to getting a job you may pass the interview as well like you did with college but without the practical knowledge that you get from lab supervisors advice you'll crash and burn.


  • Closed Accounts Posts: 3,152 ✭✭✭ozt9vdujny3srf


    it happens, people waltz through college doing as little as possible and everything is fine and dandy.

    Not the professional qualifications.


  • Registered Users, Registered Users 2 Posts: 1,831 ✭✭✭abcdggs


    i know that but i'm in first year... theres no point in working now


  • Hosted Moderators Posts: 7,486 ✭✭✭Red Alert


    If you don't get anything from typing "gcc --version" then you'll need to install the developer tools. You can either do this from your Leopard DVD or you can install XCode 3.1 for free from Apple's website. I'd go with the Apple one, so you get the up to date version.

    You needn't use the IDE if you don't want to, the debugger is helpful though when you do more complicated C assignments.


Advertisement