You'll need to be a bit more specific. What describe should work fine. foo.h: extern MPI_Datatype mydtype;
foo.cc: #inlclude "foo.h" MPI_Datatype mydtype; bar.cc: #include "foo.h" void bogus(void) { MPI_Datatype foo = mydtype; } On Oct 9, 2011, at 4:10 PM, Jack Bryan wrote: > Hi, > > I need to define a (Open MPI) MPI_Datatype in a header file so that all other > files that include it can find it. > > I also try to use extern to do decleration in .h file and then define them in > .cpp file. > > But, I always get error: > > undefined reference > > It is not allowed in Open MPI ? > > Why ? > > Any help is really appreciated. > > Thanks > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/