Re: How to display Japanese in debug console?
Re: How to display Japanese in debug console?
- Subject: Re: How to display Japanese in debug console?
- From: Norio Ota <email@hidden>
- Date: Mon, 26 Jun 2006 22:17:41 +0900
On 2006年 6月 26日 , at 05:52 PM, Chris Hanson wrote:
On Jun 25, 2006, at 7:01 PM, Norio Ota wrote:
But Carbon doesn't have NSString class, how do you think I define
NSString for using it in Carbon?
Do I need to set any flags of the build setting of the target in
Xcode?
This is the first time for me to use Cocoa function in Carbon
environment, so that I'm very sorry to bother you.
In order to make use of Cocoa functions within your code, you'll need
to do a couple of things.
First and probably most obviously, you'll need to link against
Cocoa.framework.
Next, you'll need to ensure your code is being compiled as Objective-C
or Objective-C++ rather than C or C++. You can do this by either
changing the file extension to .m for Objective-C or .mm to
Objective-C++, or by changing the file type of the file in Xcode's
inspector for the file to "sourcecode.c.objc" for Objective-C or
"sourcecode.cpp.objcpp" for Objective-C++.
Finally, you'll need to #import the appropriate header file in your
code to make the declaration visible to the compiler. You can always
just #import the framework header (e.g. <Foundation/Foundation.h> or
<Cocoa/Cocoa.h>) rather than an individual header.
One more thing: Because strings are so commonly used, Objective-C has
a shorthand for creating a constant instance of NSString: Just use an
@ in front of a constant C string, for example:
NSLog(@"Hello");
The effect of this is similar to the CFSTR() macro.
Thank you, Chris.
I'm sorry but I got 2000 compile errors. I don't know what was wrong,
so I'll show you the files I added to my Xcode project and the first
line of error message out of the 2000 errors.
---------------- CocoaFunctions.h ----------------
#include <Carbon/Carbon.h>
#include <Cocoa/Cocoa.h>
extern void DebugStringInJP ( CFStringRef cfStr );
---------------- CocoaFunctions.m ----------------
#import "CocoaFunctions.h"
void DebugStringInJP ( CFStringRef cfStr )
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog ((NSString*) cfStr);
[pool release];
}
-------------------- the first error messages out of 2000
----------------------------
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/
Foundation.frameworks/Headers/NSObjCRuntime.h:60: error expected
unqualified-id before '@' token
Thank you for your time.
norio
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden