Results 1 to 1 of 1
Thread: having problems with xcode build
-
08-12-2010, 05:14 AM #1
- Member Since
- Aug 12, 2010
- Posts
- 1
having problems with xcode buildhi 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
¬ificationIn); // iterator handle
// Install notification request for matching objects going out.
IOServiceAddMatchingNotification(
notifyPort,
kIOTerminatedNotification,
match,
matchingCallback,
NULL,
¬ificationOut);
// 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.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Xcode 4: Add Build Carbon Resources Build Phase
By Tommato in forum macOS - Development and DarwinReplies: 1Last Post: 06-15-2012, 02:27 PM -
Xcode build is really slow all of the sudden!!
By michig54 in forum iOS DevelopmentReplies: 1Last Post: 01-02-2012, 04:31 PM -
Xcode build error
By danlb in forum macOS - Operating SystemReplies: 2Last Post: 10-02-2010, 02:27 PM -
xcode build help
By universible in forum macOS - Development and DarwinReplies: 4Last Post: 02-23-2008, 04:25 AM -
XCode build hangs?
By robin in forum macOS - Development and DarwinReplies: 3Last Post: 01-12-2004, 01:42 AM