From: Andrew R. <and...@us...> - 2005-08-15 14:20:31
|
On Fri, Aug 12, 2005 at 04:07:07AM -0500, Albert Kottke wrote: > In C++, I am trying to get the viewport limits using pls.gvpd, but I get > the error: > > error: 'class plstream' has no member named 'gvpd' > > using the code: > PLFLT x0, x1, y0, y1; > pls.gvpd( &x0, &x1, &y0, &y1 ); > > The class gvpd exists in the plstream.h header file, which I am including. > The funny thing is that I can use pls.gvpw and other classes without a > problem. Does this error reproduce for anyone else? My current solution > is just to use 'plgvpd' to get the viewport limits, which isn't that big > of a deal. Hi Albert, I think your problem is that you don't need the & in C++. Unlike C, C++ has the idea of passing variables by reference. In the header file the definition of gvpd is void gvpd( PLFLT& xmin, PLFLT& xmax, PLFLT& ymin, PLFLT& ymax ); which means that we want to pass xmin, xmax etc by reference. This means that changes made to them in gvpd are passed back to the calling program. To call the routine you only need do something like PLFLT x0, x1, y0, y1; pls.gvpd( x0, x1, y0, y1 ); This is equivalent to the C way of doing things, where you pass a pointer to the variable, but it is neater. Let me know if this doesn't work. The only other thing I can think of is some conflict of versions. gvpd was only added to the C++ bindings relatively recently. It had been overlooked in the initial conversion. If gvpw works but gvpd does not then perhaps you are using an old version of plstream.h? Hope this helps. Andrew |