.cpp to .pyd

Carl Banks pavlovevidence at gmail.com
Sat Aug 9 17:15:53 EDT 2008


On Aug 9, 7:46 am, vedrandeko... at yahoo.com wrote:
> On 9 kol, 13:34, vedrandeko... at yahoo.com wrote:
>
>
>
> > On 9 kol, 01:27, Carl Banks <pavlovevide... at gmail.com> wrote:
>
> > > On Aug 8, 1:11 pm, vedrandeko... at yahoo.com wrote:
>
> > > > Thanks for quick reply.Maybe I'm crazy but I did what you said and I
> > > > stll get the same error :(  :(  :( :(.I have boost version 1.34.1 and
> > > > I'm
> > > > running it on Windows XP SP2.
>
> > > While you're at it, please post your setup.py
>
> > > Carl Banks
>
> > Hi,
>
> > Here is my setup.py script:
>
> > setup(name="MyApp",
> >     ext_modules=[
> >         Extension("hello", ["hellomodule.cpp"],
> >             libraries = ["boost_python"],
> >             include_dirs = ['D:\\Program Files\\boost\\boost_1_34_1\
> > \boost'],
> >             )
> >     ])
>
> > Regards,
> > Veki
>
> Hello,
>
> ...and here is the error:
>
> C:\Panda3D-1.5.2\python\Lib\site-packages>python setup.py build
> running build
> running build_ext
> building 'hello' extension
> D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /
> nologo /Ox
>  /MD /W3 /GX /DNDEBUG "-ID:\Program Files\boost\boost_1_34_1\boost" -

Good, it's included the directory you specified.

> IC:\Panda3D
> -1.5.2\python\include -IC:\Panda3D-1.5.2\python\PC /Tphellomodule.cpp /
> Fobuild\t
> emp.win32-2.5\Release\hellomodule.obj
> hellomodule.cpp
> hellomodule.cpp(9) : fatal error C1083: Cannot open include file:
> 'boost/python/
> module.hpp': No such file or directory

But the file is not located there.

> error: command '"D:\Program Files\Microsoft Visual Studio .NET
> 2003\Vc7\bin\cl.e
> xe"' failed with exit status 2
>
> C:\Panda3D-1.5.2\python\Lib\site-packages>pause
> Press any key to continue . . .

Ok, you have your include directory:

D:\Program Files\boost\boost_1_34_1\boost

And the file it's trying to access:

boost\python\module.hpp

The compiler tries to join the two when searching for the file to
include, like so:

D:\Program Files\boost\boost_1_34_1\boost\boost\python\module.hpp

Does this file exist on your system?  Probably not.  What you probably
did was to include the top boost directory in your setup.py when you
should have left it out like this:

include_dirs = ['D:\\Program Files\\boost\\boost_1_34_1']

If that doesn't work, find the file "module.hpp", take the complete
pathname, remove the boost\python\module.hpp part, and use that as the
include_dir.


Carl Banks



More information about the Python-list mailing list