Saturday, February 9, 2008

C++: Forward Declarations and Typedef

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

A.h:
class FwdDeclared;

----

B.h:
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 http://www.mcs.anl.gov/research/projects/mpich2/ 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 ..."

Thursday, January 31, 2008

WxWidget Linking Woes

I am trying out using WxWidgets for UI for our Crackpot project (started with the basic example at WxWidget documentation at http://www.wxwidgets.org/docs/tutorials/hello.htm)

Link errors while using WxWidgets were resolved using stuff at: http://www.soe.ucsc.edu/~agames/wxogl.htm

Some other link errors are still left :(

Updated on Feb 8, 2008:

The link errors I was getting were related to unresolved symbols:
  • wxFrameNameStr
  • wxApp::Initialize

I was able to fix these today after much hue and cry, after I built the sample projects in the wxWidgets/samples directory. I copied the VC++ settings from these samples to my project. Indeed my settings were quite a lot different from that used in samples - preprocessor definitions, system type: (I was using console in place of windows), linked library names.

Anyway, all is well that ends well. Lesson learnt: Look for samples of compilation using a downloaded open source library first, before getting stuck with a compilation problem.