Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] How I Can Access Recycle Bin Files?
mjzarrin last edited by mjzarrin
i want to develop a wiping program with a feature that can wipe recycle bin.
i coudlnt find any example with qt and i tried to dir "C:$Recycle.Bin" and find directory of recycle bin , but dir on this directory didn't get files in recycle bin, but windows show that correctly.
i find a c++ solution in the bellow link.
Recycle Bin Information with c++
but when i use this in qt , it has many errors. some of them is for using "_tprintf". changing that with "wprintf", caused that errors gone but new linker errors appear like bellow:
"main.obj:-1: error: LNK2019: unresolved external symbol __imp_CoTaskMemFree referenced in function "long __cdecl BindToCsidl(int,struct _GUID const &,void * *)" (?BindToCsidl@@YAJHAEBU_GUID@@PEAPEAX@Z)
File not found main.obj"
can anyone help me please,and tell how i can develop these code on my qt program. i was java developer and not familiar with to these problems.
thank you all.
mcosta last edited by
unresolved symbolmeans you have to link some library.
When using functions from external libraries you need to link to them first.
If you're using qmake then you do that by adding them to the LIBS variable in the .pro file.
To give you an example: the linker in the error message you posted complains about missing
CoTaskMemFreesymbol. Go to the docs for that function on MSDN, in this case it's CoTaskMemFree. Scroll down to the Requirements section and you'll see a name of the library that has this function. In this case it's
Ole32.lib. Pass it to the LIBS variable in the .pro file like this:
LIBS += -lOle32(that's a minus and lower case L). Repeat the process for any other missing symbols. There should only be like 2 or 3 of them.
As for the
_t*functions - that's part of Microsoft's unicode abstraction layer. Nowadays when you're using any of the Windows libraries (e.g. include "windows.h" like you did) you should define UNICODE, so that the _t* macros get resolved to their unicode versions, as opposed to the ANSI defaults. This will fix your errors. You can add the define in your .pro file like this:
DEFINES += UNICODE. The less attractive alternative is to substitute the macros manually to their unicode versions(like you did with _tprintf to wprintf).
mjzarrin last edited by
thank you very much.
it works perfectly with adding all you mentioned.
I am glad after 3 days, thank you.