Just getting started with Project Builder and put a file in there but the Build is greyed out. How do you get started ?
Page 1 of 1
Project Builder
#2
Posted 14 April 2003 - 06:23 AM
Be aware--you can't just make a new file (using command-N) and compile it directly. It has to be part of a project first. Did you make a new project beforehand?
For my AP Computer Science class, we make simple console applications, apps that are command-line and can run in the terminal. Since you're only compiling one file, I'm going to assume that's probably what you want to do (since most GUI programs require more than one file for compilation). If that's what you want to do, choose "New Project" and make the project type "C Tool".
For my AP Computer Science class, we make simple console applications, apps that are command-line and can run in the terminal. Since you're only compiling one file, I'm going to assume that's probably what you want to do (since most GUI programs require more than one file for compilation). If that's what you want to do, choose "New Project" and make the project type "C Tool".
#3
Posted 14 April 2003 - 06:50 AM
I tried making a new project after going to the recommended .pdf file and seeing that I had to make a new project first. But even after making a new project the Build was still greyed out. I'm taking the introductory C classes and would like to experiment with Project Builder with the programs I'm building for class. I don't like reading .pdf files because they don't scale on the screen well and ink costs so much nowadays printing the file is many many pages. Could you give me a three step process of exactly what one needs to do to compile a very simple program through Project Builder?
#4
Posted 14 April 2003 - 08:18 AM
When you say "Introductory C", you're talking about C, not just C, right? There's a difference. I know C, but not C. You can handle both with Project Builder, though.
To make a simple C application, all you have to do is this:
1) Open Project Builder and choose "New Project" from the File menu.
2) Choose the "C Tool" project, and specify a name and location for your project.
3) A new project will open. A file called "main.cpp" will contain the main program for the project. You can rename this file, delete it, do whatever with it. Doesn't matter, as long as your program has a file that contains a main() function. To begin doing some simple C, delete whatever is in the file and write a simple program.
The same steps apply to programs that are just written in C (not C), except the project type is "Standard Tool" (I think).
Here's a sample program you can use to test C in ProjectBuilder. Create a new project of type C Tool, delete whatever's in main.cpp, and paste that code in. Then choose "Build and Run", and the program will run.
Be aware! GCC on OS X is picky about the main() function. Last time I checked, it could only be of type "int". "void" won't work, and "bool" won't, either. Keep that in mind.
Try that code, and let me know what happens.
To make a simple C application, all you have to do is this:
1) Open Project Builder and choose "New Project" from the File menu.
2) Choose the "C Tool" project, and specify a name and location for your project.
3) A new project will open. A file called "main.cpp" will contain the main program for the project. You can rename this file, delete it, do whatever with it. Doesn't matter, as long as your program has a file that contains a main() function. To begin doing some simple C, delete whatever is in the file and write a simple program.
The same steps apply to programs that are just written in C (not C), except the project type is "Standard Tool" (I think).
Here's a sample program you can use to test C in ProjectBuilder. Create a new project of type C Tool, delete whatever's in main.cpp, and paste that code in. Then choose "Build and Run", and the program will run.
code:
//This program inputs two numbers from the user and adds
//them together.
#include <iostream.h>
int main()
{
int first, second;
cout << "Enter a number: ";
cin >> first;
cout << "Enter a second number: ";
cin >> second;
cout << first << " " << second << " = " << first second << endl;
return 0;
}
Be aware! GCC on OS X is picky about the main() function. Last time I checked, it could only be of type "int". "void" won't work, and "bool" won't, either. Keep that in mind.
Try that code, and let me know what happens.
#5
Posted 14 April 2003 - 08:30 AM
Hi - Thanks for the speedy reply. I'm starting with 3 quarters of "C" and then moving into C later. I think there is a C right above the C in the new file choices. I'll give it a whirl sometime before midnight. I appreciate the time it took you to draft up the reply - I'm debating on whether to spend the $59 student price for Codewarrior learner version... Sounds like a real deal! Especially since Project Builder is not as intuitive as I'd like it to be.
#7
Posted 14 April 2003 - 07:50 PM
Just got out of School . . . Now I know what I did: I chose that one at the top called Empty Project.
It's building now okay. But I have a question before I go any further. I'm starting out with C (not C) so does Project Builder do the generic C - I just built a short program and it seems to handle generic C but before I immerse myself in the intricacies of Project Builder is this a good compiler for the Generic "C" ???
It's building now okay. But I have a question before I go any further. I'm starting out with C (not C) so does Project Builder do the generic C - I just built a short program and it seems to handle generic C but before I immerse myself in the intricacies of Project Builder is this a good compiler for the Generic "C" ???
Page 1 of 1



Sign In
Register
Help



MultiQuote