473,383 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

.cpp to .pyd

Hello,

I want to build my C++ (.cpp) script to (.pyd) like this:

http://en.wikibooks.org/wiki/Python_...g_with_C%2B%2B

I have installed "Microsoft Visual studio .NET 2003" and "Boost
Python" and then after I run my setup script:

python setup.py build
I get this error:
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 -IC:\Panda3D-1.5.2\python\include -IC:
\Panda3D-1.5.2\pytho
n\PC /Tphellomodule.cpp /Fobuild\temp.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
error: command '"D:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\bin\cl.e
xe"' failed with exit status 2

I think that my MS visual studio cannot find "boost python", if
that's the problem then can you tell me how can I solve it.
This is very begginer question,but I can't find answer nowhere, and I
don't have any expirience with Microsoft products.
Sorry for my bad english!
Regards,
Veki
Aug 7 '08 #1
13 4390
I think that my MS visual studio cannot find "boost python", if
that's the problem then can you tell me how can I solve it.
This is very begginer question,but I can't find answer nowhere, and I
don't have any expirience with Microsoft products.
Hi,

Put Boost in your include path (options of Visual Studio).

Matthieu
--
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
Aug 7 '08 #2
On 7 kol, 09:48, "Matthieu Brucher" <matthieu.bruc...@gmail.com>
wrote:
I think that my MS visual studio *cannot find "boost python", if
that's the problem then can you tell me how can I solve it.
This is very begginer question,but I can't find answer nowhere, and I
don't have any expirience with Microsoft products.

Hi,

Put Boost in your include path (options of Visual Studio).

Matthieu
--
French PhD student
Website :http://matthieu-brucher.developpez.com/
Blogs :http://matt.eifelle.comandhttp://blo...z.com/?blog=92
LinkedIn :http://www.linkedin.com/in/matthieubrucher
Hello again,

Thanks for your quick reply!
Put Boost in your include path (options of Visual Studio).
Look at my image:
http://img225.imageshack.us/my.php?i...imghostfy1.png

I still get the same error.

Regards,
Veki
Aug 7 '08 #3
ve***********@yahoo.com wrote:
hellomodule.cpp(9) : fatal error C1083: Cannot open include file:
'boost/python/module.hpp': No such file or directory
You need to tell it where to find the Boost includes. I suggest you first
try to get some header-only Boost library going as example, if you have
that right, you also have the include paths right.

In your second posting, you gave a link to a picture which had the exact
right dialog for setting this as system setup. You can also set the path on
a per-project base, then it's in the C++ settings.

Note that for compiled libraries like Boost.Python you will first have to
compile those (see Boost docs), put the DLLs into a place where they can be
found (e.g. the windows dir or anything else on the path) and also have to
set a path to the .LIBS in the linker settings.

As an alternative to compiling libraries separately, you can also include
the Boost sources into your project, just add BOOST_PYTHON_STATIC_LIB to
the preprocessor defines and include the following files from one(!)
translation unit:

<boost/../libs/python/src/module.cpp>
<boost/../libs/python/src/dict.cpp>
<boost/../libs/python/src/errors.cpp>
<boost/../libs/python/src/list.cpp>
<boost/../libs/python/src/object_operators.cpp>
<boost/../libs/python/src/object_protocol.cpp>
<boost/../libs/python/src/tuple.cpp>
<boost/../libs/python/src/str.cpp>
<boost/../libs/python/src/object/class.cpp>
<boost/../libs/python/src/object/function.cpp>
<boost/../libs/python/src/object/inheritance.cpp>
<boost/../libs/python/src/object/pickle_support.cpp>
<boost/../libs/python/src/converter/builtin_converters.cpp>
<boost/../libs/python/src/converter/registry.cpp>
<boost/../libs/python/src/converter/from_python.cpp>

Note: this is with Boost 1.33.1, newer versions likely differ.
Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

Aug 7 '08 #4
It doesn't look like a VS issue since you've started the setup.py
script that calls the command line compiler. So I'd expect it behaves
not different from other command line tools and you might have to add
the boost path directly to the command-line options.
Aug 7 '08 #5
On 7 kol, 11:37, Ulrich Eckhardt <eckha...@satorlaser.comwrote:
vedrandeko...@yahoo.com wrote:
hellomodule.cpp(9) : fatal error C1083: Cannot open include file:
'boost/python/module.hpp': No such file or directory

You need to tell it where to find the Boost includes. I suggest you first
try to get some header-only Boost library going as example, if you have
that right, you also have the include paths right.

In your second posting, you gave a link to a picture which had the exact
right dialog for setting this as system setup. You can also set the path on
a per-project base, then it's in the C++ settings.

Note that for compiled libraries like Boost.Python you will first have to
compile those (see Boost docs), put the DLLs into a place where they can be
found (e.g. the windows dir or anything else on the path) and also have to
set a path to the .LIBS in the linker settings.

As an alternative to compiling libraries separately, you can also include
the Boost sources into your project, just add BOOST_PYTHON_STATIC_LIB to
the preprocessor defines and include the following files from one(!)
translation unit:

<boost/../libs/python/src/module.cpp>
<boost/../libs/python/src/dict.cpp>
<boost/../libs/python/src/errors.cpp>
<boost/../libs/python/src/list.cpp>
<boost/../libs/python/src/object_operators.cpp>
<boost/../libs/python/src/object_protocol.cpp>
<boost/../libs/python/src/tuple.cpp>
<boost/../libs/python/src/str.cpp>
<boost/../libs/python/src/object/class.cpp>
<boost/../libs/python/src/object/function.cpp>
<boost/../libs/python/src/object/inheritance.cpp>
<boost/../libs/python/src/object/pickle_support.cpp>
<boost/../libs/python/src/converter/builtin_converters.cpp>
<boost/../libs/python/src/converter/registry.cpp>
<boost/../libs/python/src/converter/from_python.cpp>

Note: this is with Boost 1.33.1, newer versions likely differ.

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
Hello again,

This answer is probably exactly what I need, but as I said, I don't
have any expirience with MS products! Is there any other easier
way except "boost python" to make .pyd from .cpp?
Aug 7 '08 #6
On Aug 7, 3:25*am, vedrandeko...@yahoo.com wrote:
Hello,

I want to build my C++ (.cpp) script to (.pyd) like this:

http://en.wikibooks.org/wiki/Python_...g_with_C%2B%2B

I have installed "Microsoft Visual studio .NET 2003" and "Boost
Python" and then after I run my setup script:

python setup.py build

I get this error:

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 -IC:\Panda3D-1.5.2\python\include -IC:
\Panda3D-1.5.2\pytho
n\PC /Tphellomodule.cpp /Fobuild\temp.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
error: command '"D:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\bin\cl.e
xe"' failed with exit status 2

I think that my MS visual studio *cannot find "boost python", if
that's the problem then can you tell me how can I solve it.
This is very begginer question,but I can't find answer nowhere, and I
don't have any expirience with Microsoft products.

Sorry for my bad english!
Regards,
Veki

First, locate the boost header files. Suppose you find the file
module.hpp in this location:

C:\boost-whatever-version\include\boost\python\module.hpp
The part that comes before boost\python\module.hpp is the required
include directory. You can tell setup to use this directory by adding
the following argument to the Extension call:

include_dirs = ['C:\\boost-whatever-version\\include']

Notice the doubling of backslashes. Remember to add the directory
where the boost header files lie on your system; don't add this line
exactly.

You should end up with a setup call that looks like this:

setup(name="blah",
ext_modules=[
Extension("hello", ["hellomodule.cpp"],
libraries = ["boost_python"],
include_dirs = ['C:\\boost-whatever-version\\include'])
])

Carl Banks
Aug 7 '08 #7
On 7 Aug., 21:43, Carl Banks <pavlovevide...@gmail.comwrote:
On Aug 7, 3:25 am, vedrandeko...@yahoo.com wrote:
Hello,
I want to build my C++ (.cpp) script to (.pyd) like this:
http://en.wikibooks.org/wiki/Python_...g_with_C%2B%2B
I have installed "Microsoft Visual studio .NET 2003" and "Boost
Python" and then after I run my setup script:
python setup.py build
I get this error:
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 -IC:\Panda3D-1.5.2\python\include -IC:
\Panda3D-1.5.2\pytho
n\PC /Tphellomodule.cpp /Fobuild\temp.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
error: command '"D:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\bin\cl.e
xe"' failed with exit status 2
I think that my MS visual studio cannot find "boost python", if
that's the problem then can you tell me how can I solve it.
This is very begginer question,but I can't find answer nowhere, and I
don't have any expirience with Microsoft products.
Sorry for my bad english!
Regards,
Veki

First, locate the boost header files. Suppose you find the file
module.hpp in this location:

C:\boost-whatever-version\include\boost\python\module.hpp

The part that comes before boost\python\module.hpp is the required
include directory. You can tell setup to use this directory by adding
the following argument to the Extension call:

include_dirs = ['C:\\boost-whatever-version\\include']

Notice the doubling of backslashes. Remember to add the directory
where the boost header files lie on your system; don't add this line
exactly.

You should end up with a setup call that looks like this:

setup(name="blah",
ext_modules=[
Extension("hello", ["hellomodule.cpp"],
libraries = ["boost_python"],
include_dirs = ['C:\\boost-whatever-version\\include'])
])

Carl Banks
One can omit double backslashes when prefixing by 'r' or 'R':

r'C:\boost-whatever-version\include'

Python is just too kind.
Aug 8 '08 #8
On 7 kol, 21:43, Carl Banks <pavlovevide...@gmail.comwrote:
On Aug 7, 3:25*am, vedrandeko...@yahoo.com wrote:
Hello,
I want to build my C++ (.cpp) script to (.pyd) like this:
http://en.wikibooks.org/wiki/Python_...g_with_C%2B%2B
I have installed "Microsoft Visual studio .NET 2003" and "Boost
Python" and then after I run my setup script:
python setup.py build
I get this error:
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 -IC:\Panda3D-1.5.2\python\include -IC:
\Panda3D-1.5.2\pytho
n\PC /Tphellomodule.cpp /Fobuild\temp.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
error: command '"D:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\bin\cl.e
xe"' failed with exit status 2
I think that my MS visual studio *cannot find "boost python", if
that's the problem then can you tell me how can I solve it.
This is very begginer question,but I can't find answer nowhere, and I
don't have any expirience with Microsoft products.
Sorry for my bad english!
Regards,
Veki

First, locate the boost header files. *Suppose you find the file
module.hpp in this location:

C:\boost-whatever-version\include\boost\python\module.hpp

The part that comes before boost\python\module.hpp is the required
include directory. *You can tell setup to use this directory by adding
the following argument to the Extension call:

include_dirs = ['C:\\boost-whatever-version\\include']

Notice the doubling of backslashes. *Remember to add the directory
where the boost header files lie on your system; don't add this line
exactly.

You should end up with a setup call that looks like this:

setup(name="blah",
* * ext_modules=[
* * * * Extension("hello", ["hellomodule.cpp"],
* * * * * * libraries = ["boost_python"],
* * * * * * include_dirs = ['C:\\boost-whatever-version\\include'])
* * ])

Carl Banks
Hi,

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.

Regards,
Veki
Aug 8 '08 #9
On Aug 8, 1:11*pm, vedrandeko...@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.

If you had done what I said you wouldn't have gotten the "same error";
if nothing else there would be some small changes in the output that
could give us a better understanding of what's wrong.

So even if it is the same error message, unless you know for a fact
that every last byte of output is exactly the same, please post it.
Carl Banks
Aug 8 '08 #10
On Aug 8, 1:11*pm, vedrandeko...@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
Aug 8 '08 #11
On 9 kol, 01:27, Carl Banks <pavlovevide...@gmail.comwrote:
On Aug 8, 1:11*pm, vedrandeko...@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
Aug 9 '08 #12
On 9 kol, 13:34, vedrandeko...@yahoo.com wrote:
On 9 kol, 01:27, Carl Banks <pavlovevide...@gmail.comwrote:
On Aug 8, 1:11*pm, vedrandeko...@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.1and
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" -
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
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 . . .
Aug 9 '08 #13
On Aug 9, 7:46*am, vedrandeko...@yahoo.com wrote:
On 9 kol, 13:34, vedrandeko...@yahoo.com wrote:
On 9 kol, 01:27, Carl Banks <pavlovevide...@gmail.comwrote:
On Aug 8, 1:11*pm, vedrandeko...@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
Aug 9 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.