当我尝试使用函数 GetLongPathName() 编译我的代码时,编译器告诉我该函数未声明。
我已经阅读了位于 @ http://msdn.microsoft.com/en-us/library/aa364980%28VS.85%29.aspx的 MSDN 文档。但是,即使我包含了这些头文件,我仍然会收到未声明的函数错误。使用该函数时应该包含哪些头文件?
#include <Windows.h>
#include <WinBase.h>
#define DLLEXPORT extern "C" __declspec(dllexport)
DLLEXPORT char* file_get_long(char* path_original)
{
long length = 0;
TCHAR* buffer = NULL;
if(!path_original)
{
return "-10";
}
length = GetLongPathName(path_original, NULL, 0);
if(length == 0)
{
return "-10";
}
buffer = new TCHAR[length];
length = GetLongPathName(path_original, buffer, length);
if(length == 0)
{
return "-10";
}
return buffer;
}
而且,如果它有所作为,我目前正在 Windows Vista 64 位上使用 Dev-C++ 进行编译。