VC6中的添加对象库在VC.net中找不到了

我是一名新手,刚开始学习windows程序设计。书上第三章HelloWorld程序要求为连接程序做一个附加的对象库,并给出了在VC6中操作方法,可在VC.net中怎么也找不到,还请各位帮忙。
---------------------------------------------------------------

A couple of warnings: If you use Microsoft Visual C++ to create a new project for this program, you need to make an addition to the object libraries the linker uses. Select the Settings option from the Project menu, and pick the Link tab. Select General from the Category list box, and add WINMM.LIB ("Windows multimedia") to the Object/Library Modules text box. You need to do this because HELLOWIN makes use of a multimedia function call, and the multimedia object library isn't included in a default project. Otherwise you'll get an error message from the linker indicating that the PlaySound function is unresolved.

这个问题是说:
对于一些特殊应用的程序,比如涉及到网络、多媒体……,他们的对象库不是默认添加的,就是说你#include的这些头文件的库需要你手动添加。

在.NET的IDE里面,你可以这样设置:
在Solution Explorer里面,在你的工程上面(不是Solution上面)点击右键,选择属性,你就可以看到你的“工程属性页面”,这里你就可以找到Linker的设置。
注意:如果你点成Solution了,弹出的就是“工作属性页面”,里面的功能都是不同的!

但是这样很麻烦,往往容易设置错误,我们更一般,更灵活的办法是:
在你的主程序代码中,在你#include完了你需要的头文件以后,用代码的方式添加你所需要的库,用描述中的例子,这样:
#pragma comment(lib, "WINMM")
或者是
#pragma comment(lib, "WINMM.LIB")
注意是预编译指令,后面都没有分号,字符串的大小写也无所谓!!!!!

Published At
Categories with Web编程
Tagged with
comments powered by Disqus