#ifndef GET_IMAGE_NAME_H_
#define GET_IMAGE_NAME_H_
#include
#include
#include
#include
using namespace std;
void getAllFiles(const string path,const string ext,vector& files);
#endif
GetImageName.cpp文件
#include "GetImageName.h"
void getAllFiles(const string path,const string ext,vector& files)
{
cout<
4、运行,就会在Debug下看到GetImageName.lib
5、测试自己的lib文件,一种方式是将GetImageName.h文件和GetImageName.lib文件放到自己的工程下,另一种是VC++目录下的包含目录和库目录将GetImageName.h文件和GetImageName.lib文件所在的目录添加上,如图

在连接器——输入加上GetImageName.lib,如图

6、测试代码
#include "GetImageName.h"
int main()
{
vector str;
getAllFiles("C:\Users\admin\Desktop\DetectResult2.0_Samples",".jpg",str);
for(int i=0;i
得到目录下所有jpg图像的文件名。
7、另一种使用lib文件方式
不在连接器——输入加上GetImageName.lib,而是在代码中加上
#pragma comment(lib,"GetImageName.lib")
路径要写对,我的lib文件就在工程下