New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Carbon, n00b problem :)


Post Reply New Thread Subscribe

 
Thread Tools
jaysonturner

 
Member Since: Mar 27, 2007
Posts: 3
jaysonturner is on a distinguished road
Mac Specs: MacBook 2Ghz Core2Duo

jaysonturner is offline
Hi,

Thought I'd have a bash at a bit of Carbon today, but Xcode keeps moaning. Ive made this simple program to print the current time.

Code:
#include <stdio.h>
#include <CoreFoundation/CoreFoundation.h>

int main (int argc, const char * argv[]) {
	
	CFAbsoluteTime time;
	time = CFAbsoluteTimeGetCurrent();
	
	printf("%d", time);
    return 0;
}
Now, with ZeroLink on, i get this error at runtime.

ZeroLink: unknown symbol '_CFAbsoluteTimeGetCurrent'
Test has exited due to signal 6 (SIGABRT).


But with ZeroLink off, i get

Undefined symbols:
_CFAbsoluteTimeGetCurrent

at compile time...

I've obviously missed something, any help would be nice
QUOTE Thanks
musicforme

 
Member Since: Mar 20, 2007
Location: Grapevine, Tx
Posts: 22
musicforme is on a distinguished road
Mac Specs: Early 2008 Mac Pro - 500 GB HD - 6 GB Ram

musicforme is offline
I've never programmed in this language, but have some experience in VB.net and Java.

I wonder if time = CFAbsoluteTimeGetCurrent() shouldn't be time = CFAbsoluteTime.GetCurrent()

Note the extra period between what is probably the Object class and the method.
QUOTE Thanks
macmini3399

 
macmini3399's Avatar
 
Member Since: Nov 25, 2005
Location: Nova Scotia
Posts: 234
macmini3399 is on a distinguished road
Mac Specs: Intel Core solo Mac mini 1.5GHz, Headless Powerbook G4 500MHz

macmini3399 is offline
Hey. CoreFoundation is not Object-Oriented, its procedural. It should go like this:

#import <Carbon/Carbon.h>

int main (int argc, const char * argv[])
{
printf("%d\n", (double)CFAbsoluteTimeGetCurrent());
return 0;
}

Quote:
Originally Posted by bubba View Post
My wife's switching.... she just doesn't know it yet
QUOTE Thanks

Post Reply New Thread Subscribe


« double-click C executable. | Flex Builder 2 »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Problem With Keyboard...... mmcltd OS X - Operating System 4 02-02-2010 06:47 PM
Microsoft Messenger Problem millenium_spike OS X - Apps and Games 4 09-16-2008 01:11 AM
closed captioning problem on eyetv pumpkinwhite OS X - Apps and Games 1 09-06-2006 08:38 PM
Colour Problem On One Account stewart OS X - Operating System 0 08-25-2006 07:42 PM
G3 Hard Drive problem joe mama Apple Desktops 1 02-18-2004 01:22 PM

All times are GMT -4. The time now is 12:11 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?