编译错误:named type definition in parentheses解决方案

今天用VC6编译7Z的SDK,报错一大堆:

Compiling...
7zFile.c
F:\VC98\INCLUDE\rpcasync.h(45) : error C2220: warning treated as error - no object file generated
F:\VC98\INCLUDE\rpcasync.h(45) : warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses
7zStream.c
Alloc.c
F:\VC98\INCLUDE\rpcasync.h(45) : error C2220: warning treated as error - no object file generated
F:\VC98\INCLUDE\rpcasync.h(45) : warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses
LzFind.c
LzFindMt.c
F:\VC98\INCLUDE\rpcasync.h(45) : error C2220: warning treated as error - no object file generated
F:\VC98\INCLUDE\rpcasync.h(45) : warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses
LzmaDec.c
LzmaEnc.c
F:\VC98\INCLUDE\rpcasync.h(45) : error C2220: warning treated as error - no object file generated
F:\VC98\INCLUDE\rpcasync.h(45) : warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses
LzmaUtil.c
F:\VC98\INCLUDE\rpcasync.h(45) : error C2220: warning treated as error - no object file generated
F:\VC98\INCLUDE\rpcasync.h(45) : warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses
Threads.c
F:\VC98\INCLUDE\rpcasync.h(45) : error C2220: warning treated as error - no object file generated
F:\VC98\INCLUDE\rpcasync.h(45) : warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses
Generating Code...
Error executing cl.exe.

原因是_RPC_ASYNC_STATE结构体的定义在引用了它的后面,定位到_RPC_ASYNC_STATE定义部分VC98\Include\RPCASYNC.H,查看定义源码如下:

typedef
enum _RPC_ASYNC_EVENT {
    RpcCallComplete,
    RpcSendComplete,
    RpcReceiveComplete
    } RPC_ASYNC_EVENT;

typedef void RPC_ENTRY
RPCNOTIFICATION_ROUTINE (
                  struct _RPC_ASYNC_STATE *pAsync,<span style="white-space:pre">	</span>//这里使用了这个结构体,但是其定义在后面
                  void *Context,
                  RPC_ASYNC_EVENT Event);
typedef RPCNOTIFICATION_ROUTINE *PFN_RPCNOTIFICATION_ROUTINE;

typedef struct _RPC_ASYNC_STATE {
    unsigned int    Size; // size of this structure
    unsigned long   Signature;
    long   Lock;
    unsigned long   Flags;
    void           *StubInfo;
    void           *UserInfo;
    void           *RuntimeInfo;
    RPC_ASYNC_EVENT Event;

    RPC_NOTIFICATION_TYPES NotificationType;
    union {
        //
        // Notification by APC
        //
        struct {
            PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
            HANDLE hThread;
            } APC;

        //
        // Notification by IO completion port
        //
        struct {
            HANDLE hIOPort;
            DWORD dwNumberOfBytesTransferred;
            DWORD dwCompletionKey;
            LPOVERLAPPED lpOverlapped;
            } IOC;

        //
        // Notification by window message
        //
        struct {
            HWND hWnd;
            UINT Msg;
            } HWND;

        //
        // Notification by event
        //
        HANDLE hEvent;

        //
        // Notification by callback function
        //
        // This option is available only to OLE
        //
        PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
        } u;

    long Reserved[4];
    } RPC_ASYNC_STATE, *PRPC_ASYNC_STATE;

解决方案:

加上前置声明:struct _RPC_ASYNC_STATE。

时间: 2024-10-10 03:04:03

编译错误:named type definition in parentheses解决方案的相关文章

iOS:编译错误Unknown type name ‘***&#39;

目前有两种情况: 1.循环引用 把你.h中导入的.m文件改成@class,然后再在.m中import 2.没有导入框架 有时是在.mm文件里面操作,这时候需要使用OC的东西,比如说NSString什么的,就需要导入foundation.h 还有其他情况请留言,谢谢分享 iOS:编译错误Unknown type name '***'

QT编译错误: multiple definition of `qMain(int, char**)&#39;

QT使用过程中来回添加修改代码,结果出现了编译错误:error: multiple definition of `qMain(int, char**)' 一直看我的源文件是都哪里有错误,最后发现是在pro文件中出的问题,频繁的添加以及移除文件,导致HEADERS以及SOURCES中会重复添加 解决办法:把重复项删除! QT编译错误: multiple definition of `qMain(int, char**)' 原文地址:https://www.cnblogs.com/MakeView6

菜鸟调错(八)—— Maven编译错误:不兼容的类型的解决方案

泛型在实际的工作中应用非常广泛,关于泛型就不在这里赘述了,感兴趣请戳<重新认识泛型>.项目中用到了如下的泛型: public <T> T query(String sql, ResultSetHandler<T> rsh) throws SQLException { return this.query(sql, rsh, (Object[]) null); } 以上代码在Eclipse中可以编译通过并成功运行,但是当你使用Maven编译的时候就会报错,错误信息如下: x

jni 编译错误error: unknown type name &#39;__va_list&#39;

platforms\android-9\arch-arm\usr\include\stdio.h:257:37: error: unknown type name '__va_list' 解决方法: 默认的android-9不兼容 Applicaton.mk  添加APP_PLATFORM := android-21 jni 编译错误error: unknown type name '__va_list'

Java,AWTUtilities,eclipse报编译错误:Access restriction: The type &#39;AWTUtilities&#39; is not API (restriction on required library &#39;C:\Program Files\Java\jre7\lib\rt.jar&#39;)

[场景]调用com.sun.awt.AWTUtilities时,eclipse提示编译错误: Access restriction: The type 'AWTUtilities' is not API (restriction on required library 'C:\Program Files\Java\jre7\lib\rt.jar') [分析]eclipse项目默认的jre版本较早. com.sun.awt.AWTUtilities是在JDK 6 update10中增加的. [解决

Ubuntu 12.04.1 OK335xS busybox-1.24.1 文件系统编译错误及解决方案

Ubuntu 12.04.1 OK335xS busybox-1.24.1 文件系统编译错误及解决方案 一.参考文档: 编译busybox的一些错误: http://blog.csdn.net/hshl1214/article/details/8668042 二.busybox 编译提示: ...... applets/usage_pod.c: In function ‘main’: applets/usage_pod.c:74:3: warning: format not a string l

(转:)Visual Studio 2012 编译错误【error C4996: &#39;scanf&#39;: This function or variable may be unsafe. 】的解决方案

在VS 2012 中编译 C 语言项目,如果使用了 scanf 函数,编译时便会提示如下错误: error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 原因是Visual C++ 2012 使用了更加安

[转]Visual Studio 2012 编译错误【error C4996: &#39;scanf&#39;: This function or variable may be unsafe. 】的解决方案

原文地址:http://www.cnblogs.com/gb2013/archive/2013/03/05/SecurityEnhancementsInTheCRT.html 在VS 2012 中编译 C 语言项目,如果使用了 scanf 函数,编译时便会提示如下错误: error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecat

Visual Studio 2012 编译错误【error C4996: &#39;scanf&#39;: This function or variable may be unsafe. 】的解决方案(转载)

转载:http://www.th7.cn/Program/c/201303/127343.shtml 原因是Visual C++ 2012 使用了更加安全的 run-time library routines .新的Security CRT functions(就是那些带有“_s”后缀的函数),请参见: <CRT函数的安全增强的版本> 下面给出这个问题的解决方案: 方法一:将原来的旧函数替换成新的 Security CRT functions. 方法二:用以下方法屏蔽这个警告: 1. 在预编译