[Revisit.SolidMCP] Porting from VS to GCC/CodeBlock

在堆砌SolidMCP的时候,暗地里是有着X Platform的想法的,今晚终于下决心开工了。

Download了CodeBlock并试着用GCC编译一把,发现错误很多啊,慢慢修改并做个笔记吧:

>>  stray '\255' in program 与 null character(s) warning

------------------------------------------------------------------------------------

s:/Server/BedRock/Config/Details/ASCIITable.h:1: error: stray '\255' in program
s:/Server/BedRock/Config/Details/ASCIITable.h:1: error: stray '\254' in program
------------------------------------------------------------------------------------

Or

------------------------------------------------------------------------------------

s:/Server/BedRock/Config/Details/ASCIITable.h:1: error: stray '\377' in program
s:/Server/BedRock/Config/Details/ASCIITable.h:1: error: stray '\376' in program
------------------------------------------------------------------------------------

原因:

ASCIITable.h的编码是Unicode,FF FE 应该就是Unicode的所谓BOM。只不过后者是八进制的罢了,为什么有时候会八进制,尚未可知。

解决方案:

用Notepad打开,在另存为对话中把将Encoding改为Ansi,重新编译,错误解决。

更多关于BOM的东西,可以看wiki

>> invalid initialization of non-const reference

-----------------------------------------------------------------------------------

Base& pDerived  = Derived_2();

S:\Server\BedRock\iTry\Try_Std_Casts.cpp|160|error: invalid initialization of non-const reference of type 'Base&' from a temporary of type 'Derived_2'|

----------------------------------------------------------------------------------

原因:

1. We must use an initializer for any const or reference member or for any member of a class type that does not have a default constructor.

2. A nonconst reference may be attached only to an object of the same type as the reference itself.

A const reference may be bound to an object of a different but related type or to an rvalue.

解决方案:

const Base& derived = Derived_2();

>> warning: no newline at end of file?Open link in new tab

原因:
在源代码最后一行没有回车。
解决方案:
在最后一行搞一个回车即可再重新编译即可。看看能不能搞个script解决这个问题。
>> requires compiler and library support for the upcoming ISO C++ standard
---------------------------------------------------------------------------------------------------
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\c++0x_warning.h|31|
error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x.
This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
-----------------------------------------------------------------------------------------------------
原因:
在工程中引用了C++0X的头文件,一路追根溯源总是能找到的。我这里的错误则为源自于对tuple的支持。
>> warning: null character(s) ignored
s:/Server/BedRock/Config/Details/ASCIITable.h:1:4: warning: null character(s) ignored

posted on 2011-05-10 23:46  飘行天下  阅读(635)  评论(0编辑  收藏  举报

导航