Hi,
I just loaded xcode from the cd (xcode 1.0). i was going through the
documentation - ADC Home > Documentation > Tools > A Quick Tour of
Xcode. i found the hello world example. it's a carbon app. when i
try to build i get an error:
Build failed (1 error)
however, the errors and warnings in the left pane is greyed out. whats
the error? how do i fix?
here is the entire main.c listing:
#include <Carbon/Carbon.h>
static OSStatus PrintHello (
EventHandlerCallRef handler, EventRef event, void *data)
{
WindowRef window = (WindowRef) data;
Rect bounds;
GetWindowPortBounds (window, &bounds);
EraseRect (&bounds);
InsetRect (&bounds, 12, 12);
TextFont (FMGetFontFamilyFromName ("\pTimes"));
TextSize (48);
TextFace (italic);
TXNDrawCFStringTextBox (CFSTR("Hello, world!"), &bounds, NULL,
NULL);
return noErr;
}
int main(int argc, char* argv[])
{
IBNibRef nibRef;
WindowRef window;
OSStatus err;
// Create a Nib reference passing the name of the nib file (without
the .nib extension)
// CreateNibReference only searches into the application bundle.
err = CreateNibReference(CFSTR("main"), &nibRef);
require_noerr( err, CantGetNibRef );
// Once the nib reference is created, set the menu bar. "MainMenu"
is the name of the menu bar
// object. This name is set in InterfaceBuilder when the nib is
created.
err = SetMenuBarFromNib(nibRef, CFSTR("MenuBar"));
require_noerr( err, CantSetMenuBar );
// Then create a window. "MainWindow" is the name of the window
object. This name is set in
// InterfaceBuilder when the nib is created.
err = CreateWindowFromNib(nibRef, CFSTR("MainWindow"), &window);
require_noerr( err, CantCreateWindow );
// We don't need the nib reference anymore.
DisposeNibReference(nibRef);
EventTypeSpec eventSpec =
{ kEventClassWindow, kEventWindowDrawContent };
InstallWindowEventHandler (window, NewEventHandlerUPP(PrintHello),
1, &eventSpec, (void *) window, NULL );
// The window was created hidden so show it.
ShowWindow( window );
// Call the event loop
RunApplicationEventLoop();
CantCreateWindow:
CantSetMenuBar:
CantGetNibRef:
return err;
}
thanks for your help.
Reinder Verlinde - 26 Oct 2005 13:46 GMT
> Hi,
>
[quoted text clipped - 7 lines]
> however, the errors and warnings in the left pane is greyed out. whats
> the error? how do i fix?
> however, the errors and warnings in the left pane is greyed out. whats
> the error? how do i fix?
There might be a menu item 'Build Results' that shows more. That window
might have a, not particularly easy to spot, splitter control that
allows you to see the entire command line: compiler call and compiler
output.
I use 'might' because I am not certain XCode 1.0 already had these, and
am not willing to roll back my setup by x years to check this.
By the way: if you search the newsgroup archives, you should be able to
find out that your problem is not exceptional for XCode 1.0. You should
really upgrade, preferably to XCode 2.1 (or later). Lacking that,
download any updates to 1.0, and try again.
Reinder