1

I am using Code::Blocks with wxWidgets. In general I have a problem similar to that described here. Ok so I copy the mathplot.h and mathplot.cpp in the project directory, add those files to the project and do #include mathplot.h in all automatically generated (not empty project) wxWidgets cpp files. Nevertheless when I try to compile it gives me the error:

/usr/include/wx-3.1-unofficial/wx/string.h|303|error: ‘wxString::wxString(int)’ is private|

How to manage this issue and to finally use wxMathPlot in code::blocks?

This is the compiler log relevant to the error:

/usr/include/wx-3.1-unofficial/wx/string.h: In member function ‘bool mpWindow::SaveScreenshot(const wxString&, int, wxSize, bool)’:

/usr/include/wx-3.1-unofficial/wx/string.h:303:3: error: ‘wxString::wxString(int)’ is private
   wxString(int); 

/home/pekov/Workshop/Code::Blocks/tester/mathplot.cpp:2239:47: error: within this context
     return screenImage.SaveFile(filename, type);
Lehue
  • 425
  • 8
  • 26
Pekov
  • 527
  • 1
  • 9
  • 23
  • @ravenspoint I add `#include mathplot.h` in the `test_App.cpp` and `test_Main.cpp` that are automatically generated for nonempty wxWidget project (called test) in code::blocks, those also have the corresponding .h files. Nevertheless the project does not compile when I only add the `mathpot.h` and `mathplot.cpp` files and do not use `#include mathplot.h` anywhere. – Pekov Sep 15 '17 at 14:39
  • 1
    "‘wxString::wxString(int)’ is private|" should have more info, in particular "required in this context". Please post all the information your compiler is providing. – ravenspoint Sep 15 '17 at 15:40
  • 1
    Yes, I remember this. mpWindow::SaveScreenshot() no longer works. Will add my "fix" – ravenspoint Sep 15 '17 at 15:59

1 Answers1

2

mpWindow::SaveScreenshot() no longer works. Since I do not use the feature, I simply commented out the final line

//    return screenImage.SaveFile(filename, type);

This allowed my projects to compile and use the other features.

It seems that you are using a version of wxMathPlot that has not been maintained for a long time. Perhaps you should try downloading the version on github which looks to be more recent and see how you get on with that.

ravenspoint
  • 19,093
  • 6
  • 57
  • 103
  • Thanks, I did the what you suggested, but now it gives me this: In file included from /home/pekov/Workshop/Code::Blocks/test_01/mathplot.cpp:36:0: /home/pekov/Workshop/Code::Blocks/test_01/mathplot.cpp: In member function ‘void mpMovableObject::ShapeUpdated()’: /usr/include/wx-3.1-unofficial/wx/log.h:1254:5: error: expected id-expression before ‘for’ for ( bool loopvar = false; – Pekov Sep 15 '17 at 18:41