firstly,I have downloaded the libconfig x64-windows via vcpkg like this:
PS E:\vcpkg> .\vcpkg install libconfig:x64-windows
then,I added the lib to my Qt project with three steps
1.add the headfile
#include "libconfig.h++"
2.specify the lib path in the pro file(I have tried two ways)
LIBS += -L$PWD -llibconfig++
#LIBS += libconfig++.lib
3.in the build debug folder,I added the libconfig++.dll
after doing those steps,project was been built successfully without any error.then I added some code like these:
libconfig::Config cfg;
try{
cfg.readFile("D:\test.cfg");
}
catch(const libconfig::FileIOException&filex) {
Q_UNUSED(filex);
qDebug()<<"error";
return;
}
qDebug()<<"success";
and the output was always :"error",I have done the everything and the Qt window was displayed successfully.Once I called readFile api,it occured an error .