使用任务调度程序1.0 COM API

时间:2022-06-14 05:38:24

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.

我正在尝试用VC ++编写一个简单的程序,它只是初始化任务调度程序。我正在关注MSDN站点上建议的示例,但是我从链接器获得了未解决的符号错误。

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

错误LNK2001:未解析的外部符号_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?

_IID_ITaskScheduler的错误相同。我有相关的头文件。我是否还需要为任何其他DLL添加依赖项?

Thanks,

Rohit

1 个解决方案

#1


2  

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.

好的,我自己发现了。您需要添加mstask.lib作为附加依赖项。转到项目属性 - >链接器 - >输入 - >其他依赖项并添加mstask.lib。链接器错误应该消失。

#1


2  

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.

好的,我自己发现了。您需要添加mstask.lib作为附加依赖项。转到项目属性 - >链接器 - >输入 - >其他依赖项并添加mstask.lib。链接器错误应该消失。