lava / matplotlib-cpp

Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib
MIT License
4.28k stars 1.12k forks source link

Why matplotlib-cpp in my Visual Studio 2019 reports errors? #277

Closed nebulaed closed 2 years ago

nebulaed commented 2 years ago

I have installed matplotlib-cpp with vcpkg, and I can find matplotlib-cpp by checking with .\vcpkg list. In addition, I have adjusted the project properties of Visual Studio 2019 as follows:

But when I ran the following simple file, some errors occurred.

#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
    Py_SetPythonHome(L"D:\\Software\\Anaconda3");
    plt::plot({ 1,3,2,4 });
    plt::show();
}

vs2019_5

Environment:

  1. Windows 10, 64 bit build 19042
  2. Visual Studio 2019
  3. cmake 3.20.5
  4. python 3.7.3
  5. numpy 1.16.4 & matplotlib 3.1.0
nebulaed commented 2 years ago

I have solved this problem. The reason for this error is the lack of Qt platform plugin. I moved the folder .../Anaconda3/Library/plugins/platforms to the folder where the exe file of the project is located, and the error disappeared.