Re: Port from Linux, namespace trouble
Jack wrote:
using namespace std;
using namespace PathFind;
Don't do this. This could import any thing into the current namespace,
including things you might not even be aware of or things that are
undocumented. This is even mentioned in the C++ FAQ at parashift's.
typedef enum {A_STAR, IDA_STAR} SearchAlgorithm;
In C++, you can write
enum SearchAlgorithm {A_STAR, IDA_STAR};
instead of using 'typedef' to assign a name to an anonymous enumeration
type.
Error 1 error C2872: 'SearchAlgorithm' : ambiguous symbol c:\documents and
settings\garfield\my documents\downloads\hpa\hpa\clusterexp.cpp
If not importing everything including the kitchen sink from 'std'
and 'PathFind' doesn't help, I guess there really is a conflict with some
other 'SearchAlgorith' name. First thing then is to find out where exactly
that name is defined. If it's in your code, just fix your code: If they are
the same, merge the declarations, otherwise rename them accordingly. If the
conflict is with one of the win32 names (the win32 headers are notorious
for their namespace pollution) you might get around by renaming your type
or by some #define hack.
Hint: to find out where the conflict is, you can insert "int
SearchAlgorithm;" into the file at the very top. The compiler will then
complain at the 'original' SearchAlgorithm's position instead of your's.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Gesch??ftsf??hrer: Thorsten F??cking, Amtsgericht Hamburg HR B62 932