Borland C++ 5.02 IDE 中的 bug

    技术2022-05-11  168

    Borland C++ 5.02 IDE 中的一个 bug

    from http://coneos.126.com

    DarkSpy在Borland C++新闻组看到关于Borland C++ 5.02 IDE中的一个bug。

    这个bug将会让编译器产生出错信息“(1,1) Bad object file record in module xxx near module offset 0x........”。DarkSpy也试验了一下,确实是一个问题。

    如果有Borland C++的fans的话,也不妨试验一下,具体步骤如下。

    建立一个工程,目标程序为MS-DOS程序,工程名字就叫tm_terror,

    然后,建立一个头文件:terror.h,里面写上代码:#ifndef terr_h#define terr_h

    namespace foo{template<class T>inline T absolute(T number){if(number < T(0) ) return -number;return number;}}

    #endif

    然后,建立:terror.cpp,写上代码:#include "terror.h"

    namespace foo2{using foo::absolute;

    int do_test(int i){ return absolute(i); }}

    然后,在工程文件:tm_terror.cpp中,写上代码:namespace foo2{ int do_test(int); /* to spare a header, declaration */ }

    int main(){return foo2::do_test(0);}

    注意,工程中,terror.cpp必须要在tm_terror.cpp上面,不是的话则用alt+up键提上去。

    然后,编译,你就会发现这个错误显示。:)

    如何解决?

    1) 在 template 中不要使用 "using namespace::name;" ,要用 "using namespace;";2) 在 IDE 中关闭 "Generate debug information" 选项。

    虽然如此,Borland C++ 5.02 仍然不失为一款强劲的编译器,DarkSpy一直使用的就是这个。:)

    DarkSpy 2001/6/3


    最新回复(0)