Question

I'm trying to write a simple program in VC++ which will just initialize the task scheduler. I'm following the example suggested at the MSDN site, but I get unresolved symbol errors from the linker.

The error is on this line:

 hr = CoCreateInstance(CLSID_CTaskScheduler,
                           NULL,
                           CLSCTX_INPROC_SERVER,
                           IID_ITaskScheduler,
                           (void **) &pITS);

The error I get is:

error LNK2001: unresolved external symbol _CLSID_CTaskScheduler

Same error for _IID_ITaskScheduler. I have the relevant header files included. Do I need to add a dependency to any other DLL as well?

Thanks,

Rohit

Was it helpful?

Solution

OK, found it out on my own. You need to add the mstask.lib as an additional dependency. Go to Project Properties -> Linker -> Input -> Additional Dependencies and add mstask.lib. The linker error should go away.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top