Saturday, February 9, 2008

C++: Forward Declarations and Typedef

Consider the situation where I have two header files A.h and B.h

class FwdDeclared;


class Defined {

typedef Defined FwdDeclared;

This is not allowed in C++ [see GOTW: 034]. The GCC compiler complains: "error: Conflicting declaration". I need to look for the rationale for this language behavior. The workaround is to use "typedef Defined FwdDeclared" in A.h too - which means you're not forward declaring the typedefed class at all. I am looking for a better way to do this.

Tuesday, February 5, 2008

Installing MPICH2

I downloaded MPICH2 from and installed it as Administrator on my lab's Windows Vista machine. After compiling my source the command
mpiexec.exe -n 1 MPICircuitSAT.exe
would not run complaining "Unable to connect to port 8676 ... No connection could be made because the target machine actively refused it." Update: Later I figured this is the error when smpd.exe is not running. Start smpd.exe using
smpd.exe -start

I then did
smpd.exe -install
in \bin, but only to receive a different error message on execution again:
"Aborting: Unable to connect ..."