How to use Mathplot in wxSmith(Code::Blocks) and w

2019-09-11 14:22发布

问题:

I am using wxSmith in Code::Blocks for a GUI application. Everything is alright for creating basic wxWidgets components but I need to plot something within.

Thus, I have downloaded MathPlot, and copied both mathplot.h and mathplot.cpp to my project folder.

There is this category 'mathplot' at the wxSmith's palette (at the bottom of the editor). I have selected the 'mpWindow' component, and added #include "mathplot.h" to my main.h file for parameters declaration etc.

My problem here is I am getting the error message "undefined reference to mpWindow::mpWindow(wxWindow*, int, wxPoint const&, ...) eventhough the function is declared in 'mathplot.h' file that I have included.

I could not find any source that shows a thorough procedures or example in using MathPlot in wxSmith or wxWidget.

Thus, if anyone could help me with this, it will be much appreciated!

I am using wxWidgets 2.8.12.

回答1:

Just in case anybody is facing the same problem, this is what I have done to solve the problem. Copy both 'mathplot.cpp' and 'mathplot.h' to the project folder, and add both files to your project by selecting Project->Add files to project... in Code::Blocks.