2014-03-27 36 views
-1

編輯:winnt.h導致問題更新後

我放棄了使SDK正常工作,而是使用MinGW提供的Windows標頭。至於SDL的問題,我剛剛評論了一些關於Windows RT的內容,在我的案例中可能沒有問題,因爲我從來沒有打算爲移動設備編譯。


我最近去一把抓住了Windows的SDK 8.1更換7.1,我不得不這樣做,因爲我去,抓起SDL 2.0.3替換2.0.1,和SDL現在依賴於文件「winapifamily。 h「,它只在8.x SDK中,而不是在7.x中,這並沒有什麼大不了的,直到我去了一個我一直在研究的網絡項目。我的代碼不是問題,這是我的環境。現在新的SDK已經建立,winnt.h引發了大量的問題。

C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|940|error: #error Must define a target architecture.| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|1311|error: 'EXCEPTION_DISPOSITION' does not name a type| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|1320|error: 'EXCEPTION_ROUTINE' does not name a type| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h||In function 'BYTE ReadUCharAcquire(const volatile BYTE*)':| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|8287|error: 'ReadAcquire8' was not declared in this scope| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h||In function 'BYTE ReadUCharNoFence(const volatile BYTE*)':| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|8298|error: 'ReadNoFence8' was not declared in this scope| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h||In function 'void WriteUCharRelease(volatile BYTE*, BYTE)':| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|8321|error: 'WriteRelease8' was not declared in this scope| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h||In function 'void WriteUCharNoFence(volatile BYTE*, BYTE)':| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|8334|error: 'WriteNoFence8' was not declared in this scope| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h||In function 'WORD ReadUShortAcquire(const volatile WORD*)':| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|8359|error: 'ReadAcquire16' was not declared in this scope| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h||In function 'WORD ReadUShortNoFence(const volatile WORD*)':| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|8370|error: 'ReadNoFence16' was not declared in this scope| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h||In function 'void WriteUShortRelease(volatile WORD*, WORD)':| C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h|8393|error: 'WriteRelease16' was not declared in this scope| ||More errors follow but not being shown.| ||Edit the max errors limit in compiler options...| ||=== Build finished: 10 errors, 0 warnings (0 minutes, 39 seconds) ===|

我一直在篡改我的環境約8小時,甚至重新安裝MinGW的思考,也許它有一些過時的標題或庫或東西。這可能是我錯過的很簡單的東西,如果任何人有任何想法可能會導致這些問題,我將不勝感激任何幫助。

微軟是否只寫了不可靠的頭文件? SDK是否僅適用於Visual Studio編譯器,如果是這樣,爲什麼在許多Windows頭文件中甚至包含winnt.h,爲什麼會有許多字母爲'GNU'和'GCC'的實例?

+0

這是重複的http://stackoverflow.com/questions/2022112/can-g-mingw-play-nice-with-the-windows-sdk-is-visual-studio-the-only-option? – rfernandes

+0

我希望。我嘗試添加-mwindows,但它沒有幫助。我以前不需要它,但是...只有新的SDK有這個問題。 – rsethc

+0

我會建議,然後偷看到winnt.h和winapifamily.h,看看他們期待的是什麼#defines - 它可能最終會變得簡單,只需要在makefile的CFLAGS變量中添加一個「-D 」 ... – rfernandes

回答

1

我知道這有點太晚了,但對於那些仍然有同樣問題的人。
問題確實源於環境。特別是,從包括目錄指向winnt.h的兩個不同版本,並在您的情況下,也可能winsock2.h鑑於您說它是您正在處理的網絡應用程序。
背景:有2個列表,包括文件在您的項目中。一位來自你proyect設置,第二個來自於全球包括編譯設置中定義,的順序
也許,在你以前的配置中,winnt.h,winsock2.h等取自全局設置,它指向了Mingw提供的文件,但是現在肯定的是,它們在包含路徑中SDK(也發生在我身上)。
您的問題是優先之一。來自SDK的「windows」文件不能與Mingw一起使用,而Mingw包含這些文件,但被修改。
你需要做的是將你的項目設置'包括目錄放在列表的頂部,在全局設置中找到指向Mingw提供的文件的目錄,以這些方式windows文件取自Mingw中包含的文件,而不是SDK。
希望這會有所幫助。