shlwapi.h包含后为什么会无效?

ny1986 2019-08-25 08:45:38

#include <iostream>
#include <fstream>
#include <math.h>
#include <opencv2/opencv.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <vector>
#include <map>
#include <time.h>
#include <Shlwapi.h>
#pragma comment(lib,"shlwapi.lib")//此语句用于建立文件夹路径


using namespace cv;
using namespace std;


int main()
{
//建立图像保存文件夹路径
string filepath_out = "..\\output\\purewhite\\";
if (!PathIsDirectory(filepath_out.c_str()))
{
CreateDirectory(filepath_out.c_str(), NULL);//创建目录,已经存在的话不影响
}

for (int i = 1; i < 38; i++)
{
string filepath_in = "..\\input\\purewhite\\" + to_string(i) + "\\";
Mat imgLeft = imread(filepath_in + "ImgLeft_9.bmp", 0);
Mat imgRight = imread(filepath_in + "ImgRight_9.bmp", 0);

filepath_out += to_string(i);
if (!PathIsDirectory(filepath_out.c_str()))
{
CreateDirectory(filepath_out.c_str(), NULL);
}
imwrite(filepath_out + "\\ImgLeft.bmp", imgLeft);
imwrite(filepath_out + "\\ImgRight.bmp", imgRight);

}

system("pause");
}

如上所示的程序,其中需要建立输出文件夹路径。但是在包含了shlwapi.h和lib文件后,程序中依然提示“未定义标识符PathIsDirectory”。后来将这两个需要包含的文件放在CPP文件的最开头处就没问题了。这个好奇怪啊,什么原因呢?有经验的大神请帮忙看看,谢谢。
...全文
306 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
ny1986 2019-11-28
  • 打赏
  • 举报
回复
多谢楼上的答复,分数奉上。
赵4老师 2019-08-26
  • 打赏
  • 举报
回复
条件编译变量冲突 我猜

64,683

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧