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

ny1986 ny1986 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

#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文件的最开头处就没问题了。这个好奇怪啊,什么原因呢?有经验的大神请帮忙看看,谢谢。
...全文
评论 1
收藏 已收藏
分享
返回顶部
ny1986
C++ 语言 65,214 成员 250,514 内容