看板 C_and_CPP 關於我們 聯絡資訊
想要從Excel讀取資料 或是輸出資料至Excel 從精華區找到了 http://www.codeproject.com/KB/database/cspreadsheet.aspx 下載後 卻在編譯時發現有很多錯誤 都是在sqltypes.h與odbcinst.h中 我想問的是 這些不都是C++內建的標頭檔嗎? 為什麼還會有錯呢? 下面我列出幾個編譯錯誤的地方 c:\program files\microsoft sdks\windows\v6.0a\include\sqltypes.h(137) : error C2146: 語法錯誤 : 遺漏 ';' (在識別項 'SQLHWND' 之前) c:\program files\microsoft sdks\windows\v6.0a\include\sqltypes.h(137) : error C4430: 遺漏型別規範 - 假設為 int。注意: C++ 不支援 default-int c:\program files\microsoft sdks\windows\v6.0a\include\odbcinst.h(102) : error C4430: 遺漏型別規範 - 假設為 int。注意: C++ 不支援 default-int c:\program files\microsoft sdks\windows\v6.0a\include\odbcinst.h(103) : error C2143: 語法錯誤 : 遺漏 ';' (在 '__stdcall' 之前) c:\program files\microsoft sdks\windows\v6.0a\include\odbcinst.h(98) : 請參閱 'BOOL' 的宣告 我是用XP跟Visual Studio 2008 Professional 90天試用版 想請問各位大大 問題是出在哪邊呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.31.134.229
minazukimaya:如果你有自己的.h檔 include在這兩個檔案之前 10/02 02:02
minazukimaya:請檢查你的.h檔 最後一個class的定義有沒有加分號 10/02 02:02
minazukimaya:#include這種preprocessor只是幫你作複製貼上文字 10/02 02:03
minazukimaya:所以compile error也有可能是出在你自己的.h檔裡 10/02 02:04
rahim:檢查過了 我在include這兩個.h檔前 沒有include自己的.h檔 10/03 00:36
ledia:有可能 #include 他們的檔之前也要 #include 別的檔 (也許是 10/03 01:02
ledia:某些必要的系統檔), 看看錯誤該處的 code 大概猜是少了什麼 10/03 01:02
ledia:也可能是需要 #define 一些常數 10/03 01:04
ledia:google 了一下, 這題在前面 #include <windows.h> 試試 10/03 01:10
rahim:#include<windos.h>之後 很多錯誤沒了 不過編譯錯在這邊 10/03 09:42
rahim:fatal error C1083: 無法開啟包含檔案: 'windos.h': No such 10/03 09:42
rahim:file or directory 10/03 09:43
rahim:google了一下 好像是不支援開發Windows應用程式 所以沒有提 10/03 11:01
rahim:供windos.h? 10/03 11:01
rahim:這跟我一開始建構的專案類型是Win32主控台應用程式有關係嗎? 10/03 11:02
ledia:windows.h ..... 你有沒有打錯 10/03 23:04
rahim:嗯 的確打錯了 抱歉.... 10/04 02:25
rahim:改好後 編譯後又有下列錯誤 fatal error C1189: #error : 10/04 02:29
rahim: Building MFC application with /MD[d] (CRT dll version) 10/04 02:30
rahim:requires MFC shared dll version. Please #define_AFXDLL 10/04 02:30
rahim:or do not use /MD[d] 10/04 02:30
rahim:google後 找到http://codingnote.blogspot.com/2008/03/ 10/04 04:09
rahim:solution-mfc-and-fatal-error-c1189.html 10/04 04:09
rahim:照上面網址修改後 又發生下列錯誤fatal error C1189: #error 10/04 04:29
rahim:WINDOWS.H already included. MFC apps must not #include 10/04 04:29
rahim:<windows.h> 10/04 04:29