Korrupted Posted August 17, 2006 Share Posted August 17, 2006 So I'm following Apple's IOKit tutorial at Here, right? Well, it won't compile, because of this error: expected unqualified-id before string constant at this line: extern "C" Wtf is wrong? Here is my HelloIOKit.cpp(copy pasted with a few edits..): #include <IOKit/IOLib.h> #include "HelloIOKit.h" extern "C" { #include <pexpert/pexpert.h>//This is for debugging purposes ONLY } // Define my superclass #define super IOService // REQUIRED! This macro defines the class's constructors, destructors, // and several other methods I/O Kit requires. Do NOT use super as the // second parameter. You must use the literal name of the superclass. OSDefineMetaClassAndStructors(com_DaxTsurugi_driver_HelloIOKit, IOService) bool com_DaxTsurugi_driver_HelloIOKit::init(OSDictionary *dict) { bool res = super::init(dict); IOLog("Initializing\n"); return res; } void com_DaxTsurugi_driver_HelloIOKit::free(void) { IOLog("Freeing\n"); super::free(); } IOService *com_DaxTsurugi_driver_HelloIOKit::probe(IOService *provider, SInt32 *score) { IOService *res = super::probe(provider, score); IOLog("Probing\n"); return res; } bool com_DaxTsurugi_driver_HelloIOKit::start(IOService *provider) { bool res = super::start(provider); IOLog("Starting\n"); return res; } void com_DaxTsurugi_driver_HelloIOKit::stop(IOService *provider) { IOLog("Stopping\n"); super::stop(provider); } And HelloIOKit.h: #include <IOKit/IOService.h> class com_DaxTsurugi_driver_HelloIOKit : public IOService { OSDeclareDefaultStructors(com_DaxTsurugi_driver_HelloIOKit) public: virtual bool init(OSDictionary *dictionary=0); virtual void free(void); virtual IOService *probe(IOService *provider, SInt32 *score); virtual bool start(IOService *provider); virtual void stop(IOService *provider); } Any ideas? Link to comment Share on other sites More sharing options...
bofors Posted August 17, 2006 Share Posted August 17, 2006 Try commenting out that whole extern C clause and see if it compiles. Link to comment Share on other sites More sharing options...
Korrupted Posted August 17, 2006 Author Share Posted August 17, 2006 Same error, now directing me to OSBase.h: __BEGIN_DECLS Link to comment Share on other sites More sharing options...
bofors Posted August 17, 2006 Share Posted August 17, 2006 I think you need to double check that you have correctly edit the plist and set Xcode's build settings. Also make sure you "clean" between builds when dealing with a issue like this. Otherwise, try starting with one of Apple's pre-built IOKit examples and take it apart instead. Link to comment Share on other sites More sharing options...
np_ Posted August 18, 2006 Share Posted August 18, 2006 And HelloIOKit.h: #include <IOKit/IOService.h> class com_DaxTsurugi_driver_HelloIOKit : public IOService { OSDeclareDefaultStructors(com_DaxTsurugi_driver_HelloIOKit) public: virtual bool init(OSDictionary *dictionary=0); virtual void free(void); virtual IOService *probe(IOService *provider, SInt32 *score); virtual bool start(IOService *provider); virtual void stop(IOService *provider); }; you did eat ";" Link to comment Share on other sites More sharing options...
Korrupted Posted August 19, 2006 Author Share Posted August 19, 2006 Thanks, np_. I feel like an idiot. Link to comment Share on other sites More sharing options...
Recommended Posts