views:

329

answers:

1

Hello,

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

+1  A: 

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.

Rohit