-1

I have written a flappy bird clone in c++. Now I would like to try writing an AI to play that game. I would really prefer to use python to write the neural network, so I need to figure out some way to access the Bird object from c++. Then I would (hopefully) be able to call the bird's draw method from python and access all of its data--I think. After doing some research, I found that the best solution would probably be pybind11. The problem is that I cannot figure out how to add it to my VS c++ project. The tutorials say to use cmake; however, my project does not use cmake. I thought that a "header only" library meant that there are just .h files that you include in your source file, without having to build. Am I wrong? And if so, how do I go about adding pybind11 (or another, better library [I didn't want to use boost::python because I didn't want to deal with the whole boost dependency]) to my project. Sorry for the long-winded nature of this question and thank you in advance.

  • Visual Studio can use `cmake`. But AFAICT, the CMake stuff is just to make it easy to find the headers. The "whole boost dependency" isn't that bad either, as Visual Studio can use `nuget` to get a prebuilt Boost package. – MSalters Apr 28 '20 at 14:28
  • So how would I go about including it in VS without using cmake? – delicious goat Apr 29 '20 at 01:53

1 Answers1

0

Microsoft provides a how to for wrapping C++ code into python dll using boost or pybind11: Check here: https://learn.microsoft.com/en-us/visualstudio/python/working-with-c-cpp-python-in-visual-studio?view=vs-2019#pybind11

Jean-Marc Volle
  • 3,113
  • 1
  • 16
  • 20