错误C4430 c ++:缺少类型说明符 - 假定为int

时间:2013-05-10 09:24:40

标签: c++ visual-c++

我用指纹机创建win7日志应用程序,指纹机sdk提供UFScanner.h头文件,当我尝试在我的.cpp代码中使用“UFS_STATUS”时 它给了我这些错误:

错误1错误C4430:缺少类型说明符 - 假定为int。注意:C ++不支持default-int

错误2错误C2086:'int ufs_res':重新定义

 

    #ifndef _UFSCANNER_H_
    #define _UFSCANNER_H_
    #define __extension__

    #ifdef UFS_EXPORTS
    #define UFS_API __declspec(dllexport) __stdcall
    #else
    #define UFS_API __stdcall
    #endif
    #define UFS_CALLBACK __stdcall

    #ifdef __cplusplus
    extern "C" {
    #endif


    // Status Definition
    #define UFS_STATUS               int

    // Status Return Values
    #define UFS_OK                  0
    #define UFS_ERROR               -1
    #define UFS_ERR_NO_LICENSE          -101
    #define UFS_ERR_LICENSE_NOT_MATCH       -102
    #define UFS_ERR_LICENSE_EXPIRED         -103
    #define UFS_ERR_NOT_SUPPORTED           -111
    #define UFS_ERR_INVALID_PARAMETERS      -112
    ...

和.cpp代码:

 

    #include 
    #include 
    #ifndef WIN32_NO_STATUS
    #include 
    #define WIN32_NO_STATUS
    #endif
    #include 
    #include "CSampleCredential.h"
    #include "guid.h"
    #include "windows.h"

    #include "UFScanner.h"
    #define __extension__

    #define TEMPLATE_SIZE 384

    UFS_STATUS ufs_res;
    int nScannerNumber;

    ufs_res = UFS_Init(); //ufs_res gives error : this declaration has no storage class or type specifier

...

1 个答案:

答案 0 :(得分:1)

你不能在函数之外放置一个简单的赋值语句:

ufs_res = UFS_Init(); 

您需要将其与ufs_res的定义结合使用,如下所示:

UFS_STATUS ufs_res = UFS_Init();
相关问题