Portal   Forum   Members   Market   Gallery   Events

For the programming experts

Discussion in 'Help Forum' started by charlybrown, Nov 12, 2002.

  1. charlybrown

    charlybrown Peasant

    Joined:
    Feb 20, 2001
    Messages:
    991
    Likes Received:
    6
    Market Rating:
    0
    I wish to use the developer tools to do my c++ assignments, however, compiling and building seems to be totally different then MS visual studio. Can anyone help me on that please?
     
  2. Haite

    Haite Forum Moderator

    Joined:
    Jan 29, 2001
    Messages:
    9,325
    Likes Received:
    34
    Market Rating:
    0
    Well first of all you have to remember that anything compiled on your Mac won't run for the teacher. If that's okay though then the easiest compiler/linker in the Dev tools is GCC. It's CLI-based, but very easy to use from the terminal once you figure it out (and even that only takes a few seconds).
     
  3. charlybrown

    charlybrown Peasant

    Joined:
    Feb 20, 2001
    Messages:
    991
    Likes Received:
    6
    Market Rating:
    0
    Hold on, the teacher won't run it, I just need the program codes. Are they the same codes or not? causee they are all c++ right?
     
  4. Jakeman

    Jakeman MSC Founder and Donator

    Joined:
    Feb 26, 2000
    Messages:
    25,761
    Likes Received:
    27
    Market Rating:
    16
    the code should be the same for basic stuff, i think. but i'm not sure.
     
  5. Haite

    Haite Forum Moderator

    Joined:
    Jan 29, 2001
    Messages:
    9,325
    Likes Received:
    34
    Market Rating:
    0
    Yes, it's the same for everything up to API calls. On UNIX though you don't really use anything besides a text editor for creating command line programs, you only start using workspace Visual Studio-style programs if you need to make a GUI.
     
  6. charlybrown

    charlybrown Peasant

    Joined:
    Feb 20, 2001
    Messages:
    991
    Likes Received:
    6
    Market Rating:
    0
    Alright, what I need is simply basic stuffs, I just started classes. So what I need is a text editor, I know that one. But if I want to test it on my home computer, how do I do to run it, that's what I don't know. Seriously, I'm not going to create anything really great, I only use iostream.h and math.h as additional hidden files. So how should I proceed using the developer tools included in the computer?
     
  7. Haite

    Haite Forum Moderator

    Joined:
    Jan 29, 2001
    Messages:
    9,325
    Likes Received:
    34
    Market Rating:
    0
    Search for where the dev tools places all the header files so you can stick the location into your program. After it's all written in a text editor, open up a Terminal. The Terminal application is in your Applications/Utilities folder. From the terminal:

    Code:
    [localhost#]gcc -o <program name> /source/file.cpp
    Substitute what you want the executable file to be called for "<program name>", for example "/Applications/test_program", and subsctitute the location of your .c or .cpp file for "/source/file.cpp". After it's done, change folders to where you put the output file, in this case the Applications folder, thusly on the terminal:

    Code:
    [localhost#]cd /Applications
    then run it:

    Code:
    [localhost#]./test_program
    It will now run on the command line just like if you were on Windows it would run in the DOS prompt.
     

Hitometer: 54,651,911 since 1995