a0071299 2016-07-05 17:00 采纳率: 100%
浏览 1707
已结题

VS2013 LNK2019的问题

代码是#include
#include "stdio.h"
#include "stdlib.h"
//#include "“winbase.h”"

#define BUFSIZE 1024

BOOL GetDiverInfo(LPSTR szDrive);

int main(int argc, CHAR* argv[])
{

CHAR szLogicaldriveStrings[BUFSIZE];
PCHAR szDrive;
ZeroMemory(szLogicaldriveStrings, BUFSIZE);
GetLogicalDriveStrings(BUFSIZE - 1, szLogicaldriveStrings);
szDrive = (PCHAR)szLogicaldriveStrings;
do
{
    if (!GetDiverInfo(szDrive))
    {
        printf("\nGet Volume Information Error : %d ", GetLastError());

    }
    szDrive += (lstrlen(szDrive) + 1);
} while (*szDrive != '\x00');

return 0;

}

BOOL GetDriverInfo(LPSTR szDrive)
{
UINT uDriverType;
DWORD dwVolumeSerialNumber;
DWORD dwMaximumComponentlength;
DWORD dwFileSystemFlags;
CHAR szFileSystemNameBuffer[BUFSIZE];
CHAR szDriveName[MAX_PATH];

printf("\n%s\n", szDrive);
uDriverType = GetDriveType(szDrive);

switch (uDriverType)
{
case DRIVE_UNKNOWN:
    printf("The driver type cannot be determined!");
    break;
case DRIVE_NO_ROOT_DIR:
    printf("The root path is invalid,for example,no volume is mounted at the path");
    break;
case DRIVE_REMOVABLE:
    printf("The drive is a type that has removable media,for example:a floppy drive or removable hard disk");
    break;
case DRIVE_FIXED:
    printf("The drive is a type that cannot be removed, for example,a fixed hard drive");
    break;
case DRIVE_REMOTE:
    printf("This drive is a remote(network) drive");
    break;
case DRIVE_CDROM:
    printf("This drive is a CD-ROM drive.");
    break;
case DRIVE_RAMDISK:
    printf("This drive is a RAM disk");
    break;
default:
    break;
}

if (!(GetVolumeInformation(
    szDrive,
    szDriveName,
    MAX_PATH,
    &dwVolumeSerialNumber,
    &dwMaximumComponentlength,
    &dwFileSystemFlags,
    szFileSystemNameBuffer,
    BUFSIZE)))
{
    return FALSE;

}

if (0 != lstrlen(szDriveName))
{
    printf("\nDrive Name is %s.\n", szDriveName);
}

printf("\nVolume Serial is %u.", dwVolumeSerialNumber);
printf("\nMaximum Component Length is %u.", dwMaximumComponentlength);
printf("\nSystem Type is %s.\n", szFileSystemNameBuffer);

if (dwFileSystemFlags & FILE_VOLUME_QUOTAS)
{

    printf("The file system supports disk Quotas.\n");
}

if (dwFileSystemFlags & FILE_SUPPORTS_REPARSE_POINTS)
{
    printf("The file system does not support volume mount points.\n");

}

if (dwFileSystemFlags & FILE_CASE_SENSITIVE_SEARCH)
{
    printf("The file system supports case-sentitive file name.\n");
}

printf("...\n");

return TRUE;

}

错误是错误 1 error LNK2019: 无法解析的外部符号 "int __cdecl GetDiverInfo(char *)" (?GetDiverInfo@@YAHPAD@Z),该符号在函数 _main 中被引用 D:\资料\代码\mfc测试\遍历卷并获取其属性\遍历卷并获取其属性\源.obj 遍历卷并获取其属性

  • 写回答

3条回答 默认 最新

  • threenewbee 2016-07-05 21:17
    关注

    GetDiverInfo这个函数不是api函数,问你,你是在哪里定义的,或者从哪里抄来的代码。

    评论

报告相同问题?

悬赏问题

  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员