1

I installed the Digital Mars C/C++ compiler on Windows. This is the full paid version that include pre-built STLPort) It's dm852.zip, but dmc reports 8.42n. STLPort says version 4.5.3 in the readme.

As required to use STLPort, I updated sc.ini to have:

INCLUDE="%@P%..\stlport\stlport";"%@P%..\include";%INCLUDE%

The following test program compiles fine with MinGW g++ but with dmc gives the errors shown in the comments.

#include <assert.h>
#include <utility>
using namespace std;
using namespace std::rel_ops;

class C {
    int x;
public:
    C(int x_) : x(x_)
        { }
    bool operator<(const C& other) const
        { return x < other.x; }
    bool operator==(const C& other) const
        { return x == other.x; }
};

int main() {
    C a(1);
    C b(1);
    C c(2);

    assert(a == b);
    assert(b != c); // Error: illegal operand types Had: C and C
    assert(a < c);
    assert(c > a); // Error: illegal operand types Had: C and C
    return 0;
}

I can find the actual relops code in dm/stl/stl_relops.h

But I'm not sure how this code is supposed to get included by dm/stlport/stlport/utility

The Digital Mars version of STLPort appears to be configured to not use the rel_ops namespace (#define _STLP_NO_RELOPS_NAMESPACE in dm/stlport/stlport/config/stl_dm.h) but omitting "using namespace std::rel_ops" didn't help.

It seems like this must be some kind of configuration issue but I haven't been able to figure it out.

Andrew McKinlay
  • 2,431
  • 1
  • 24
  • 27
  • 1
    Just [don't use `std::rel_ops`](http://stackoverflow.com/q/6225375/636019). – ildjarn Aug 01 '12 at 03:04
  • Thanks, but that doesn't answer the question. I have a large code-base that makes use of rel_ops. It compiles and runs fine with G++ and Visual C++. Aren't rel_ops part of the standard? My example is pretty much identical to that given in The C++ Standard Library by Josuttis. – Andrew McKinlay Aug 01 '12 at 14:53

0 Answers0