Jump to content

IOKit woes..


6 posts in this topic

Recommended Posts

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

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

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

 Share

×
×
  • Create New...