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

visual error C4430 c++ : missing type specifier - int assumed

本文关键字:int 说明符 类型 c++      更新时间:2023-10-16

我正在创建带有指纹机的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
...

不能在函数外部放置普通的赋值语句:

ufs_res = UFS_Init(); 

你需要像这样把它和ufs_res的定义结合起来:

UFS_STATUS ufs_res = UFS_Init();