nurgan
nurgan

Reputation: 53

C++ enum is not a member of

I am trying to access a enum that is defined in a class of a library (ogdf) I use.

See line 65 here for the definition of the enum in the library.

If I try to access it like that (which I would think is the correct way):

ogdf::StressMinimization::TERMINATION_CRITERION::POSITION_DIFFERENCE

I get the following error:

error: ‘ogdf::StressMinimization::TERMINATION_CRITERION’ has not been declared

If I try to do it like that:

ogdf::StressMinimization::POSITION_DIFFERENCE

I get this error:

error: ‘POSITION_DIFFERENCE’ is not a member of ‘ogdf::StressMinimization’

Of course I'm including the header in my .cpp file via:

#include <ogdf/energybased/StressMinimization.h>

As this is part of the ogdf library, there are no problems with circular includes, which seems to be most frequent problem that causes that.

I can't see why this is happening, any help is greatly appreciated! If you need any further details, please let me know, I'll update the question.

Upvotes: 1

Views: 2378

Answers (1)

Kdawg
Kdawg

Reputation: 1518

Assuming that you're on the latest, it may be that the name of the enum changed and that documentation is old; looks like that documentation is from 2015, latest snapshots are (currently) from February 2017. From https://github.com/ogdf/ogdf/blob/master/include/ogdf/energybased/StressMinimization.h, the enum looks like this now:

enum class TerminationCriterion {
    None, PositionDifference, Stress
};

So, try replacing TERMINATION_CRITERION with TerminationCriterion and/or POSITION_DIFFERENCE with PositionDifference and see if that works.

Upvotes: 1

Related Questions