1

An include at the top of a cpp file in my project is #include <vigra/numpy_array.hxx>, but this fails when I try to build (cmake, c++11) because /usr/local/include/vigra/numpy_array.hxx:46:10: fatal error: 'numpy/arrayobject.h' file not found. Any ideas what is wrong and how I can fix this? I'm aware of the related cython questions, but they're all specific to this error in a setup.py.

Additional info:

  • I've installed vigra (and tested it's successful)
  • I have find_package( VIGRA REQUIRED ) in my CMakeLists.txt
  • Trying make --include-dir=/usr/local/include/vigra doesn't help
BoltzmannBrain
  • 5,082
  • 11
  • 46
  • 79

2 Answers2

0

You need to install vigra is installed on your system and included. I assume you've already installed it, but then you'll need to make sure it's in your include path for your compiler. As stated on their website:

VIGRA is mainly a header library, i.e. much of its functionality can be accessed by simply copying the include files to a convenient location.

So, it looks like you can just add a folder of vigra headers to your project and include directly from there.

In addition, numpy must be installed and available in the path. You can do this by including the Python headers with numpy installed in your linker/makefile.

meyer9
  • 1,120
  • 9
  • 26
  • Thanks, yes I have vigra installed. So it looks like I need to include the appropriate headers in my project. Sorry if this is a noob ask, but would you mind giving some details as to how I can do this? An example would be very helpful. – BoltzmannBrain Mar 20 '17 at 16:29
  • `-I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5` would be the include path for mac, but it depends on your install location – meyer9 Mar 20 '17 at 16:31
  • Sorry, should've bee more clear about my question: How can I "add a folder of vigra headers to your project and include directly from there"? – BoltzmannBrain Mar 20 '17 at 18:36
0

ipython import numpy numpy.get_include()

sudo cp -r /Users/xxxxxxxxxx/anaconda3/envs/sd/lib/python3.10/site-packages/numpy/core/include/numpy /usr/local/include

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 24 '23 at 10:45