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.

having problems with xcode build


Post Reply New Thread Subscribe

 
Thread Tools
ironhide707

 
Member Since: Aug 12, 2010
Posts: 1
ironhide707 is on a distinguished road

ironhide707 is offline
hi all,
This is my first post in this forum. I hope i will get what i want :-). Anyways here it goes.
I recently made a I/O Kit driver on xcode in mac os x leopard. Everything is working fine except for the build, whenever i click the build it shows me this error:

incompatible flag -framework used (must specify "-dynamic" to be used)
Command /Developer/usr/bin/g++-4.0 failed with exit code 1.

Please tell me what is the problem with this code.
For obvious reasons. i have the code here and a picture of the error with with the project tree on the left-side:

#include <unistd.h>
#import <IOKit/storage/IOMedia.h>
#import <CoreFoundation/CoreFoundation.h>
#import <IOKit/IOKitLibs.h>

int
printDictionaryAsXML(CFDictionaryRef dict)
{
CFDataRef xml = CFPropertyListCreateXMLData(kCFAllocatorDefault,
(CFPropertyListRef)dict);
if (!xml)
return -1;

write(STDOUT_FILENO, CFDataGetBytePtr(xml), CFDataGetLength(xml));
CFRelease(xml);

return 0;
}

void
matchingCallback(void *refcon, io_iterator_t deviceList)
{
kern_return_t kr;
CFDictionaryRef properties;
io_registry_entry_t device;

// Iterate over each device in this notification.
while ((device = IOIteratorNext(deviceList))) {

// Populate a dictionary with device's properties.
kr = IORegistryEntryCreateCFProperties(
device, (CFMutableDictionaryRef *)&properties,
kCFAllocatorDefault, kNilOptions);

if (kr == KERN_SUCCESS)
printDictionaryAsXML(properties);

if (properties)
CFRelease(properties);

if (device)
IOObjectRelease(device);
}
}

int
main(void)
{
CFMutableDictionaryRef match;
IONotificationPortRef notifyPort;
CFRunLoopSourceRef notificationRunLoopSource;
io_iterator_t notificationIn, notificationOut;

// Create a matching dictionary for all IOMedia objects.
if (!(match = IOServiceMatching("IOMedia"))) {
fprintf(stderr, "*** failed to create matching dictionary.\n");
exit(1);
}

// Create a notification object for receiving I/O Kit notifications.
notifyPort = IONotificationPortCreate(kIOMasterPortDefault);

// Get a CFRunLoopSource that we will use to listen for notifications.
notificationRunLoopSource = IONotificationPortGetRunLoopSource(notifyPort);

// Add the CFRunLoopSource to the default mode of our current run loop.
CFRunLoopAddSource(CFRunLoopGetCurrent(), notificationRunLoopSource,
kCFRunLoopDefaultMode);
// One reference of the matching dictionary will be consumed when we install
// a notification request. Since we need to install two such requests (one
// for ejectable media coming in and another for it going out), we need
// to increment the reference count on our matching dictionary.
CFRetain(match);

// Install notification request for matching objects coming in.
// Note that this will also look up already existing objects.
IOServiceAddMatchingNotification(
notifyPort, // notification port reference
kIOMatchedNotification, // notification type
match, // matching dictionary
matchingCallback, // this is called when notification fires
NULL, // reference constant
&notificationIn); // iterator handle

// Install notification request for matching objects going out.
IOServiceAddMatchingNotification(
notifyPort,
kIOTerminatedNotification,
match,
matchingCallback,
NULL,
&notificationOut);

// Invoke callbacks explicitly to empty the iterators/arm the notifications.
matchingCallback(0, notificationIn);
matchingCallback(0, notificationOut);

CFRunLoopRun(); // run

exit(0);
}



Hope you will help me.
Ironhide707.
QUOTE Thanks

Post Reply New Thread Subscribe


« Grand Central Dispatch Programming | xcode generates .h .m files in chinese »
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
content.yieldmanager.edgesuite.net XCODE nachohi88 Internet, Networking, and Wireless 1 03-27-2010 09:41 PM
Xcode, Subversion, and directory behaviour Reinderien OS X - Development and Darwin 1 03-10-2009 11:50 AM
Xcode 1.5 alejandrico OS X - Development and Darwin 0 06-03-2006 05:56 PM
Mac OS X (10.4.5 - Build 8G1454) Problems... sbatson OS X - Operating System 3 02-27-2006 05:41 PM
XCode build hangs? robin OS X - Development and Darwin 3 01-12-2004 01:42 AM

All times are GMT -4. The time now is 03:57 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?