Created
February 27, 2012 10:06
-
-
Save Vdragon/1922909 to your computer and use it in GitHub Desktop.
某個地方的文章
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
由於之前一直拿Linux(GNU GCC)當作我的開發環境,所以這一次實習我也硬是先拿GNU編譯器當作開發環境了 | |
不過在完成所有的要求,要移植到Visual Studio時遇到了一些問題: | |
1.在C++程式中include C library會出現關於不相容Common Language Runtime的錯誤 | |
解法:在專案選項中關閉Common Language Runtime(/clr)(似乎是.NET程式才會用到的功能)。 | |
2.UTF-8文字編碼(encoding)的原始程式碼檔案用Visual C++ compiler 編譯會出現很多無法從code中找到的error(似乎是編譯器的parsing出問題) | |
Build log如下:https://gist.github.com/1907441 | |
目前的(暫時)解決方法是全部轉成BIG5(Codepage 950)才能順利編譯 | |
不過網路上有人提到UTF-8程式原始碼要加上BOM(Byte Order Mark),我還沒試 | |
至於行結尾(EOL)符號則是目前沒有發現對編譯結果造成影響 | |
3.Visual C++ 編譯器的語法檢查某些部份比GNU GCC/G++編譯器還要嚴格,例如宣告語句(declaration statement)不能直接跟一般的語句(statement)混在一起,GCC上編譯會警告,但是Visual C++編譯器則是直接給error。 | |
解法:儘量按照標準的規範寫code | |
以上給先前開發環境是使用GNU 編譯器(包含Dev-C++、Code::Blocks、Eclipse等IDE...)的同學做參考。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment