1. 程式人生 > >error C2144: 語法錯誤 : “void”的前面應有“;” error C4430: 缺少型別說明符

error C2144: 語法錯誤 : “void”的前面應有“;” error C4430: 缺少型別說明符

不想細究的同學,按照圖所示修改,簡單明瞭;

或者在主檔案 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 開始找起。考驗閱讀程式碼的時刻。

相關推薦

error C2144: 語法錯誤 : “void”的前面應有“;” error C4430: 缺少型別說明符

不想細究的同學,按照圖所示修改,簡單明瞭; 或者在主檔案 include 標頭檔案之前加上下面幾行程式碼  #ifndef WIN32 #define WIN32 #endif 查詢錯誤根源: 首先雙擊VC錯誤列表第一項(從前往後改正bug是一個良好的習慣!)

error C2143: 語法錯誤 : 缺少“;”(在“&”的前面)

報錯:   error C2143: 語法錯誤 : 缺少“;”(在“&”的前面) 程式碼: #include <iostream> ostream & << (ostream& os, int i) {   return os <<

使用Opencv2遇到error C2061: 語法錯誤: 標識dest

pan post times 編譯 sign imp vfl ifd with 在寫代碼是遇到了這樣一個問題,error C2061: 語法錯誤: 標識符“dest”: 1>d:\opencv\opencv\build\include\opencv2

VS2010中的編譯錯誤error C2061: 語法錯誤: 識別符號"string"

編譯程式時出現: error C2061: 語法錯誤: 識別符號"string" 仔細查,在出現錯誤的類的標頭檔案裡已經 #include "String" 經過查詢網上資料,解決如下: 增加一行: using namespace std;

VS2010:error C2061: 語法錯誤

例項: 類名 類中包含的標頭檔案 point iostream line point、flat flat line 輸出錯誤: er

【VS2013】error C2059: 語法錯誤:“::” error C2589: “(”:“::”右邊的非法標記

1.error: 錯誤 6 error C2059: 語法錯誤:“::” e:\anzhuang\opencv\build\include\opencv2\flann\lsh_table.h 266

VS2015 配置 海康威視 SDK 環境,報錯,error C4430: 缺少型別說明符

錯誤描述: 1>C:\Users\Administrator\Desktop\CH-HCNetSDK(Windows32)V5.2.1.3_build20160513\標頭檔案\HCNetSDK.h(38268): error C3690: 應該為字串文字,但找到的是

MFC之標頭檔案相互包含問題及解決方法 error C4430: 缺少型別說明符

問題一: error C4430: 缺少型別說明符 - 假定為 int。注意: C++ 不支援預設 int 原因分析: 1. (此情況經常出現在大型工程專案中)如果存在兩個類的標頭檔案a.h和b.h,在a.h中有這樣的語句:#include "b.h",在b.h檔案中有這樣的

C4430錯誤,“C4430 缺少型別說明符

今天在學習函式,編寫練習題程式碼時,出現上述錯誤資訊,程式碼如下: #include "pch.h" #include <iostream> #include<string> void replace(int &i, int &a

PHP關於syntax error語法錯誤的問題(Parse error: syntax error, unexpected end of file in xxxxxxxx)

在php程式出現類似 Parse error: syntax error, unexpected end of file in xxxxxxxx  on line xx 的錯誤。 如果發現php的語法本身沒有什麼錯誤。就有可能是使用了短標籤,例如: <? }?&

python syntax error語法錯誤

1.    print(print)   TypeError: 'int' object is not callable print = 3 print(print) 2.coding : utf-8    &n

VC++常見錯誤原因解析之error LNK2019: 無法解析的外部符號 "public: void __thiscall

VC++常見錯誤原因解析之error LNK2019: 無法解析的外部符號 "public: void __thiscall 出現這個錯誤,應該首先檢視“#include”語句是否包含,或者是否包含正確。符號無法解析意味著編譯器知道有這個符號存在,也就是有宣告,但在連結時,找不到實現程式碼,

【C/C++】【FAQ】令人費解的編譯錯誤error C2144: syntax error : 'double' should be preceded by ';' 和 error C3646:

今天程式設計莫名其妙的出現了以下兩個編譯錯誤: 1>e:\日常學習\plsa_nmf\plsa_nmf\sutil.h(10): error C3646: ';' : unknown override specifier 1>e:\日常學習\plsa_nmf\plsa_nmf\sutil.h(1

配置NDK Cygwin .bash_profile:行47: 語法錯誤: 未預期的檔案結尾 syntax error: unexpected end of file 解決

可以在cygwin中通過vim修改,也可以在windows安裝目錄中修改 home\<你的使用者名稱>\.bash_profile 檔案中最後新增環境變數 NDKROOT=/cygdrive/e/Andriod/develop/android-ndk-r8

mysql錯誤【一】[ERROR] Missing system table mysql.proxies_priv

mysql錯誤 環境:mysql一主一從架構,主庫是mysql5.1,從庫是mysql5.6;系統均為CentOS6.2 問題: 在主庫上面執行的SQL語句 1.創建表 CREATE TABLE `app_versions` ( `date` date NO

symbol lookup error *** , undefined symbol 錯誤

fine 報錯 error: 重裝 ucs usr which -1 yun 在重裝samba過程後遇到一些問題,使用 gdb 時產生報錯: gdb: symbol lookup error: gdb: undefined symbol: PyUnicodeUCS2_Fro

VC6的工程轉到VC2010或更高版本出現fatal error C1189編譯錯誤的解決方法

代碼 ram 選擇 spa file 線程 c11 靜態庫 block 以前也遇到過,當時解決了沒寫下來,這次正好又遇到了,就順手寫一下吧,別下次又忘記了。 當VC6的工程轉到VC2010或更高版本時編譯出現如下錯誤: c:\program files\micros

error C2065:!錯誤:未定義標識“pBuf);”

str 標識符 error 未定義標識符 image ima 標識 http 使用 error C2065: “pBuf);”: 未聲明的標識符 錯誤原因:第二個括號)使用的是中文符號!還有最後那個分號! 改回來就好了~ 原錯誤: 修

VS2010出現FileTracker : error FTK1011編譯錯誤的解決辦法

cnblogs 編譯器 VS2010 error itl log .cn http 出現 VS2010出現FileTracker : error FTK1011編譯錯誤的解決辦法 今天編譯器出現如下警告: 上網查解決辦法: FileTracker : error FTK

[譯]Javascript中的錯誤信息處理(Error handling)

java https ror 信息處理 esc execute 函數 丟失 youtube 本文翻譯youtube上的up主kudvenkat的javascript tutorial播放單 源地址在此: https://www.youtube.com/watch?v=PMs