shlobj.h编译出错的解决方法!

类别:编程语言 点击:0 评论:0 推荐:

 

 

Be sure to include the following header in the COM object header file:

#include <shlobj.h>

Now you find out if you need to makes some changes before continuing. Hit build and you may likely be greeted with some error messages.

> [C++ Error] shlobj.h(1762): E2238 Multiple declaration for 'FVSHOWINFO' > [C++ Error] shlobj.h(1936): E2238 Multiple declaration for 'FOLDERSETTINGS' > [C++ Error] shlobj.h(3717): E2238 Multiple declaration for 'DESKBANDINFO' > [C++ Error] shlobj.h(4808): E2238 Multiple declaration for 'SHELLFLAGSTATE'

This problem is addressed in the upd1rdme.txt file in the builder directory, which appears after applying the service pack. For what it's worth, I have never tried the solution suggested in the upd1rdme.txt file. I simply commented the areas out of the ShlObj.hpp. Later I would read a post by Alex Bakaev [Team B] in borland.public.cppbuilder.activex that suggested commenting out the offending parts from the ShlObj.hpp file also. So there you have it. Someone in the know also suggests the "comment it out" solution. Great minds think alike, and all that.

The following code was all that I commented out of ShlObj.hpp to get the project to build.

//typedef FVSHOWINFO *PFVShowInfo; //typedef FVSHOWINFO TFVShowInfo; //typedef FOLDERSETTINGS *PFolderSettings; //typedef FOLDERSETTINGS TFolderSettings; ... //typedef DESKBANDINFO *PDeskBandInfo; //typedef DESKBANDINFO TDeskBandInfo; ... //typedef SHELLFLAGSTATE *PShellFlagState; //typedef SHELLFLAGSTATE TShellFlagState;

As I said, I commented the areas out of the ShlObj.hpp file. You can do the same, or you can try the solution in the upd1rdme.txt file. I know at least one of them works for sure.

After you have made the changes the project should now build. Of course , it does nothing of any use to us yet. But building the project is always an accomplishment in C++, so you might as well celebrate this small victory.

 

另:shobjidl.h也出过错,我用安装文件中的同名文件替换当前文件.解决了.怀疑是之前改动过了.

本文地址:http://com.8s8s.com/it/it27484.htm