[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