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.
This is my first attempt at any code. I've got a C++ tutorial with lots of sample code to refer to. It tells you to compile some of the code to test your compiler. I installed a default installation of xcode 2.0. When I have a .cpp file open in xcode it won't allow me to compile. Everything under Build is greyed out as is all but three under Debug. Any suggestions on how I should do this?
Here's the code I used:
Code:
// Chapter 1 - Program 1 - CONCOM.CPP
#include <iostream.h> /* This is the stream definition file */
void print_it(const int data_value);
int main()
{
const int START = 3; // The value of START cannot be changed
const int STOP = 9; // The value of STOP cannot be changed
volatile int CENTER = 6; /* The value of CENTER may be changed
by something external to this
program. */
int index; /* A normal C variable */
for (index = START ; index < STOP ; index++)
print_it(index);
return 0;
} /* End of program */
void print_it(const int data_value)
{
cout << "The value of the index is " << data_value << "\n";
}
// Result of execution
//
// The value of the index is 3
// The value of the index is 4
// The value of the index is 5
// The value of the index is 6
// The value of the index is 7
// The value of the index is 8
iMac 17" 2GHz Core2Duo | 1GB RAM | 160GB hdd | Superdrive | Tiger and XP Pro
Xcode can only build projects, not individual files. You can make a project with just that file in it, or you can use the C++ command line tool (c++ myfile.cpp).
Chuck ___ "Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."