I am having some trouble building a simple C++ project in Windows.
What I want to do:
- Run some simple code in C++
- Print a graph using the matplotlibcpp library.
I installed the matplotlibcpp library by using vcpkg. I have a problem with the matplotlibcpp.h header including Python.h.
I obtain this error: Error code 1083 - Cannot open include file: 'Python.h': No such file or directory.
I have anaconda installed on my PC and the path to Python is added to the environment PATH in Windows.
My code:
#include "matplotlibcpp.h"
using namespace std;
namespace plt = matplotlibcpp;
int main()
{
cout << "Hello!" << endl;
plt::plot({ 1,3,2,4 });
plt::show();
return 0;
}
My CMakeList.txt:
cmake_minimum_required (VERSION 3.8)
project ("MyProj" VERSION 1.0)
include_directories(include)
# Add source to this project's executable.
file(GLOB_RECURSE SOURCES "src/*.cpp")
add_executable (MyEx ${SOURCES} "main.cpp" "main.h")
find_path(MATPLOTLIB_CPP_INCLUDE_DIRS "matplotlibcpp.h"
HINTS
C:/Users/claudiop/dev/vcpkg/vcpkg/installed/x86-windows/include/matplotlibcpp.h)
target_include_directories(MyEx PRIVATE ${MATPLOTLIB_CPP_INCLUDE_DIRS})
I tried to follow indications in this post can't include Python.h in visual studio but I did not manage to solve the problem.
Any suggestion/help/hint?