error C2144: 语法错误 : “void”的前面应有“;” error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int;

不想细究的同学,按照图所示修改,简单明了;

或者在主文件 include 头文件之前加上下面几行代码

 #ifndef WIN32

#define WIN32

#endif







查找错误根源:

首先双击VC错误列表第一项(从前往后改正bug是一个良好的习惯!)跳转到发生编译错误的代码行,例如:




WINGDIAPI 是这个文件中第一个错误提示处(绝大部分错误最初的源头就在这个符号)。

接下来在整个磁盘中查找WINGDIAPI 的定义。

#ifndef WIN32


    // Required for compatibility with glext.h sytle function definitions of
    // OpenGL extensions, such as in src/osg/Point.cpp.
    #ifndef APIENTRY
        #define APIENTRY
    #endif


#else // WIN32


    #if defined(__CYGWIN__) || defined(__MINGW32__)


        #ifndef APIENTRY
                #define GLUT_APIENTRY_DEFINED
                #define APIENTRY __stdcall
        #endif
            // XXX This is from Win32's <windef.h>
        #ifndef CALLBACK
            #define CALLBACK __stdcall
        #endif


    #else // ! __CYGWIN__


        // Under Windows avoid including <windows.h>
        // to avoid name space pollution, but Win32's <GL/gl.h>
        // needs APIENTRY and WINGDIAPI defined properly.
        // XXX This is from Win32's <windef.h>
        #ifndef APIENTRY
            #define GLUT_APIENTRY_DEFINED
            #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
                #define WINAPI __stdcall
                #define APIENTRY WINAPI
            #else
                #define APIENTRY
            #endif
        #endif


            // XXX This is from Win32's <windef.h>
        #ifndef CALLBACK
            #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
                #define CALLBACK __stdcall
            #else
                #define CALLBACK
            #endif
        #endif

找到这段代码,从WINGDIAPI 开始找起。考验阅读代码的时刻。

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值