In my application, I used wxWidgets library and PLplot's wxwidgets binding: wxPLplotwindow.h.
I have successfully built PLplot library but when using PLplot wxwidgets, the following errors occurred. Could someone help me with this problem?
I really need to fix these errors occurred from PLplot's wxwidgets binding and then proceed to build my application.
I look forward to your help.
Thanks and Regards,
Dingjun
........................ [ 47%] Building CXX object LibProject/src/CMakeFiles/PHCSharedlibrary.dir/twacRcnstruct.cpp.obj [ 48%] Building CXX object LibProject/src/CMakeFiles/PHCSharedlibrary.dir/xyzUtils.cpp.obj [ 49%] Building CXX object LibProject/src/CMakeFiles/PHCSharedlibrary.dir/xyzfilein.cpp.obj [ 50%] Linking CXX static library C:\Users\Dingjun.Chen\PHC_cmake\PHC_EXE_Lib_mingw64_plplot2\lib\libPHCSharedlibrary.a [ 50%] Built target PHCSharedlibrary [ 51%] Building CXX object MainProject/src/CMakeFiles/PHC_EXEProject.dir/BasePlot.cpp.obj
In file included from C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/BasePlot.h:23,
from C:\Users\Dingjun.Chen\PHC_cmake\PHC_EXE_Lib_mingw64_plplot2\MainProject\src\BasePlot.cpp:34:
C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/plotWindow.h:83:7: error: class template 'wxPLplotwindow' redeclared as non-template
83 | class wxPLplotwindow;
| ^~~~~~~~~~~~~~
In file included from C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/plotWindow.h:21:
C:/Users/Dingjun.Chen/Downloads/plplot-5.14.0.tar/plplot-5.14.0/bindings/wxwidgets/wxPLplotwindow.h:37:7: note: previous declaration here
37 | class wxPLplotwindow : public WXWINDOW
| ^~~~~~~~~~~~~~
C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/plotWindow.h:86:1: error: expected class-name before '{' token
86 | {
| ^
/** plotWindow.h **/
ifndef PLOT_WINDOW_H
define PLOT_WINDOW_H
include <wx msgdlg.h=""></wx>
include <wx textctrl.h=""></wx>
include <wx timer.h=""></wx>
include "wxPLplotwindow.h" // For graph window.
ifndef MAX
define MAX( a, b ) ( ( a ) < ( b ) ? ( b ) : ( a ) )
endif
ifndef MIN
define MIN( a, b ) ( ( a ) < ( b ) ? ( a ) : ( b ) )
endif
// Maximum count of commands in Queue.
define MAX_CMND_CNT 5
// Structure which hold command queue.
typedef struct {
int cmnd; // Command to execute. ( ie, zoom, move, none )
int dir; // Direction when applicable.
bool served; // When set the struct is waiting to be served.
double currWx; // Current world coordinate for x.
double currWy; // Current world coordinate for y. ( Needs direction correction!!! )
double lastWx; // Last world coordinate for x.
double lastWy; // Last world coordinate for y.
double zoomFactor; // Zoom factor when applicable.
// Events to be generated for the cal plot class.
wxDECLARE_EVENT( gemEVT_PLOT_ACTION_EVENT, wxCommandEvent );
// Notifies parent of some action
class wxPLplotwindow;
// Generic class interfacing with the plplot. To be used by other plot classes
class PlotWindow : public wxPLplotwindow
{
public:
~PlotWindow(){ m_timerPtr->Stop(); }
PlotWindow( wxFrame * frame, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0,
int pl_style = wxPLPLOT_NONE );
virtual void OnMouseWheel( wxMouseEvent & );
private:
wxFrame * m_framePtr; // Pointer to parent class.
wxTimer * m_timerPtr; // Pointer to timer
plotNavStructT m_aPlotCmnd[MAX_CMND_CNT]; // Command list
double m_dZoomFactor;
int m_iNextCmndIdx; // Index of the next command in queue
int m_iKeyDelayCount; // Delay between key strokes
int m_iWheelDelayCount; // Delay between wheel events
wxPoint m_currMouseLoc; // Current x,y location of mouse.
wxPoint m_lastMouseLoc; // Last x,y location of mouse.
Hi, Dear Sir or Madam,
In my application, I used wxWidgets library and PLplot's wxwidgets binding: wxPLplotwindow.h.
I have successfully built PLplot library but when using PLplot wxwidgets, the following errors occurred. Could someone help me with this problem?
I really need to fix these errors occurred from PLplot's wxwidgets binding and then proceed to build my application.
I look forward to your help.
Thanks and Regards,
Dingjun
........................
[ 47%] Building CXX object LibProject/src/CMakeFiles/PHCSharedlibrary.dir/twacRcnstruct.cpp.obj
[ 48%] Building CXX object LibProject/src/CMakeFiles/PHCSharedlibrary.dir/xyzUtils.cpp.obj
[ 49%] Building CXX object LibProject/src/CMakeFiles/PHCSharedlibrary.dir/xyzfilein.cpp.obj
[ 50%] Linking CXX static library C:\Users\Dingjun.Chen\PHC_cmake\PHC_EXE_Lib_mingw64_plplot2\lib\libPHCSharedlibrary.a
[ 50%] Built target PHCSharedlibrary
[ 51%] Building CXX object MainProject/src/CMakeFiles/PHC_EXEProject.dir/BasePlot.cpp.obj
In file included from C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/BasePlot.h:23,
from C:\Users\Dingjun.Chen\PHC_cmake\PHC_EXE_Lib_mingw64_plplot2\MainProject\src\BasePlot.cpp:34:
C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/plotWindow.h:83:7: error: class template 'wxPLplotwindow' redeclared as non-template
83 | class wxPLplotwindow;
| ^~~~~~~~~~~~~~
In file included from C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/plotWindow.h:21:
C:/Users/Dingjun.Chen/Downloads/plplot-5.14.0.tar/plplot-5.14.0/bindings/wxwidgets/wxPLplotwindow.h:37:7: note: previous declaration here
37 | class wxPLplotwindow : public WXWINDOW
| ^~~~~~~~~~~~~~
C:/Users/Dingjun.Chen/PHC_cmake/PHC_EXE_Lib_mingw64_plplot2/MainProject/include/plotWindow.h:86:1: error: expected class-name before '{' token
86 | {
| ^
/** plotWindow.h **/
ifndef PLOT_WINDOW_H
define PLOT_WINDOW_H
include <wx msgdlg.h=""></wx>
include <wx textctrl.h=""></wx>
include <wx timer.h=""></wx>
include "wxPLplotwindow.h" // For graph window.
ifndef MAX
define MAX( a, b ) ( ( a ) < ( b ) ? ( b ) : ( a ) )
endif
ifndef MIN
define MIN( a, b ) ( ( a ) < ( b ) ? ( a ) : ( b ) )
endif
// Maximum count of commands in Queue.
define MAX_CMND_CNT 5
// Structure which hold command queue.
typedef struct {
int cmnd; // Command to execute. ( ie, zoom, move, none )
int dir; // Direction when applicable.
bool served; // When set the struct is waiting to be served.
double currWx; // Current world coordinate for x.
double currWy; // Current world coordinate for y. ( Needs direction correction!!! )
double lastWx; // Last world coordinate for x.
double lastWy; // Last world coordinate for y.
double zoomFactor; // Zoom factor when applicable.
} plotNavStructT;
//--------------------------------------------------------------------------
// constants
//--------------------------------------------------------------------------
enum { PLUS_SIGN =43,
MINUS_SIGN =45 };
// Comand set
enum {
NULLCMD = 100,
MOVE_CMD,
ZOOM_IN,
ZOOM_OUT,
ZOOM_IN_H,
ZOOM_OUT_H,
ZOOM_IN_V,
ZOOM_OUT_V
};
// Direction
enum {
NO_DIR = 200,
UP_DIR,
DN_DIR,
LT_DIR,
RT_DIR,
ZOOM_ONLY
};
// Events to be generated for the cal plot class.
wxDECLARE_EVENT( gemEVT_PLOT_ACTION_EVENT, wxCommandEvent );
// Notifies parent of some action
class wxPLplotwindow;
// Generic class interfacing with the plplot. To be used by other plot classes
class PlotWindow : public wxPLplotwindow
{
public:
~PlotWindow(){ m_timerPtr->Stop(); }
PlotWindow( wxFrame * frame, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0,
int pl_style = wxPLPLOT_NONE );
virtual void OnMouseWheel( wxMouseEvent & );
private:
wxFrame * m_framePtr; // Pointer to parent class.
wxTimer * m_timerPtr; // Pointer to timer
plotNavStructT m_aPlotCmnd[MAX_CMND_CNT]; // Command list
double m_dZoomFactor;
int m_iNextCmndIdx; // Index of the next command in queue
int m_iKeyDelayCount; // Delay between key strokes
int m_iWheelDelayCount; // Delay between wheel events
wxPoint m_currMouseLoc; // Current x,y location of mouse.
wxPoint m_lastMouseLoc; // Last x,y location of mouse.
bool m_bLeftMouseBtnIsDn; // Logic indicates left mouse button is pressed.
bool m_bRightMouseBtnIsDn; // Logic indicates right mouse button is pressed.
// Converts mouse location to world coordinates.
void CurrWorldPointUpdate( wxPoint, double & , double & );
// Generates command events for the frame.
void NavigationCmndGenrate( int, int, int = 0 );
void OnChar( wxKeyEvent & ); // Keyboard event handler.
// Mouse event handlers.
virtual void OnMouseMotion( wxMouseEvent & );
virtual void OnMouseLeftDn( wxMouseEvent & );
virtual void OnMouseLeftUp( wxMouseEvent & );
virtual void OnMouseRightDn( wxMouseEvent & );
virtual void OnMouseRightUp( wxMouseEvent & );
// Timer event handlers.
virtual void OnTimerEvent( wxTimerEvent & );
};
endif // PLOT_WINDOW_H