社区
C++ Builder
帖子详情
为什么我的C++Builder不能#include
?
kevincsdn
2003-06-03 11:09:41
为什么我的C++Builder不能#include <shlobj.h>?
编译时,会和shobjdl.h出现冲突,多重声明。
...全文
121
11
打赏
收藏
为什么我的C++Builder不能#include <shlobj.h>?
为什么我的C++Builder不能#include ? 编译时,会和shobjdl.h出现冲突,多重声明。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
11 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
kevincsdn
2003-06-04
打赏
举报
回复
从理论上来说,#include <shlobj.h>不用放在cpp文件最前面,可以放在头文件里。
经我多次验证,只要在#include <vcl.h>之前#define NO_WIN32_LEAN_AND_MEAN 即可。
<vcl.h>是在cpp文件包含的,而且在Unit.h之前,所以#define NO_WIN32_LEAN_AND_MEAN不能在头文件中定义。而#include <shlobj.h>完全可以放在头文件中。
完美解决,结分!
Behard
2003-06-04
打赏
举报
回复
看看 精华区 和 FAQ
zywx
2003-06-03
打赏
举报
回复
不好意思,都要放到cpp文件的最前面,不能放到头文件里
zywx
2003-06-03
打赏
举报
回复
还有把#include <shlobj.h>也要放到最前面
zywx
2003-06-03
打赏
举报
回复
记住要放到
#include <shlobj.h>的前面
kevincsdn
2003-06-03
打赏
举报
回复
我包含的头文件如下:
#ifndef Unit1H
#define Unit1H
#define NO_WIN32_LEAN_AND_MEAN
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ToolWin.hpp>
#include <ExtCtrls.hpp>
#include <IdBaseComponent.hpp>
#include <IdComponent.hpp>
#include <IdFTP.hpp>
#include <IdTCPClient.hpp>
#include <IdTCPConnection.hpp>
#include <IdIntercept.hpp>
#include <IdAntiFreeze.hpp>
#include <IdAntiFreezeBase.hpp>
#include "IdLogEvent.hpp"
#include <IdLogBase.hpp>
#include <ImgList.hpp>
#include "PERFGRAP.h"
#include <Buttons.hpp>
#include "trayicon.h"
#include <shlobj.h>
kingcaiyao
2003-06-03
打赏
举报
回复
#define NO_WIN32_LEAD_AND_MEAN
#include "shlobj.h"
zywx
2003-06-03
打赏
举报
回复
怎么会没用呢
一般还要包含
#include <ComObj.hpp>
kevincsdn
2003-06-03
打赏
举报
回复
错了,不是和shobjdl.h冲突,错误提示如下:
Build
[C++ Error] shobjidl.h(2193): E2238 Multiple declaration for 'FOLDERSETTINGS'
[C++ Error] shobjidl.h(8095): E2238 Multiple declaration for 'DESKBANDINFO'
[C++ Error] shlobj.h(1422): E2238 Multiple declaration for 'FVSHOWINFO'
[C++ Error] shlobj.h(3457): E2238 Multiple declaration for 'SHELLFLAGSTATE'
[C++ Warning] Unit1.cpp(88): W8070 Function should return a value
kevincsdn
2003-06-03
打赏
举报
回复
没用啊。
zywx
2003-06-03
打赏
举报
回复
在最前面加上
#define NO_WIN32_LEAN_AND_MEAN // 调用SHELL API 需包含的
C语言创建快捷方式举例
C语言创建快捷方式,
c++builder
测试通过。 /* C run time library headers */ #
include
#
include
#
include
/* COM headers (requires shell32.lib, ole32.lib, uuid.lib) */ #
include
#
include
shl
obj
.h编译出错的解决方法!
Be sure to
include
the following header in the COM
obj
ect header file:#
include
Now you find out if you need to makes some changes before continuing. Hit build and you may likely be greeted wit
C++ 获取系统文件夹路径
比如获取桌面路径: // 需要 #
include
<
Shl
obj
.h> char path[255]; SHGetSpecialFolderPath( NULL, // 保留 path...
四极管:
C++builder
文件及目录的操作
文章是转的,但是发现有些问题,现在补上: 一、判断目录是否存在: C++ Builder中提供了检查文件是否存在的函数FileExists,indows 程序实现如下: 设char *Dir为带判断的目录 bool Exist; // 最后结果,表示目录是否存在 if(Dir[strl
利用Shell对象控制Windows系统
作者:ccrun
本文是ccrun(老妖)根据互联网上搜集来的资料整理而成.非原创.
▲0. 初始化环境和OLE对象
#
include
#
include
<
shl
obj
.h>
// 初始化COM环境
CoInitialize(NULL);
// 创建Shell对象
Variant vShellOLE = Variant::Create
Obj
ect("Shell.Applic
C++ Builder
13,825
社区成员
102,679
社区内容
发帖
与我相关
我的任务
C++ Builder
C++ Builder相关内容讨论区
复制链接
扫一扫
分享
社区描述
C++ Builder相关内容讨论区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章